You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/09/07 15:12:48 UTC

svn commit: r573568 - /incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java

Author: gnodet
Date: Fri Sep  7 06:12:47 2007
New Revision: 573568

URL: http://svn.apache.org/viewvc?rev=573568&view=rev
Log:
SM-1045: Accept property replacement when generating SA descriptor

Modified:
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java?rev=573568&r1=573567&r2=573568&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java Fri Sep  7 06:12:47 2007
@@ -332,6 +332,19 @@
         List orderedServiceUnits = new ArrayList();
         while (dependencies.hasNext()) {
             Dependency dependency = (Dependency) dependencies.next();
+            if (dependency.getArtifactId().contains("${")) {
+                int first = dependency.getArtifactId().indexOf("${");
+                int last  = dependency.getArtifactId().indexOf("}");
+                String property = dependency.getArtifactId().substring(first + 2, last);
+                Object propValue = project.getProperties().get(property);
+                if (propValue == null) {
+                    throw new MojoExecutionException("The value for the property " + property + "is not set."
+                            + "Jbi descriptor may not be generated properly");
+                }
+                String propString = (String) propValue;
+                String artifactID = dependency.getArtifactId().replace("${" + property + "}", propString);
+                dependency.setArtifactId(artifactID);
+            }
             for (Iterator it = serviceUnits.iterator(); it.hasNext();) {
                 DependencyInformation serviceUnitInfo = (DependencyInformation) it
                         .next();