Author: ffang
Date: Sat Nov  7 09:38:13 2009
New Revision: 833659

URL: http://svn.apache.org/viewvc?rev=833659&view=rev
Log:
[SM-1904]JBI Maven plugin is unable to manage several SU based on the same 
component in the same SA

Modified:
    
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
    
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml

Modified: 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
URL: 
http://svn.apache.org/viewvc/servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java?rev=833659&r1=833658&r2=833659&view=diff
==============================================================================
--- 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
 (original)
+++ 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
 Sat Nov  7 09:38:13 2009
@@ -403,6 +403,32 @@
                 return child.getArtifact().getArtifactId();
             }
         }
+        
+        //as the jbi-component packaged dependency may already have been pruned
+        //in case of multiple sus which belong to same jbi-component exist in 
one sa, so we
+        //just check the dependencies from this su maven project to find the 
jbi-component name
+        
+        for (Iterator it = project.getArtifacts().iterator(); it.hasNext();) {
+            Artifact artifactInSUPom = (Artifact) it
+                    .next();
+            MavenProject artifactProject = null;
+            try {
+                artifactProject = 
projectBuilder.buildFromRepository(artifactInSUPom
+                        , remoteRepos, localRepo);
+            } catch (ProjectBuildingException e) {
+                getLog().warn(
+                        "Unable to determine packaging for dependency : "
+                                + artifactInSUPom.getArtifactId()
+                                + " assuming jar");
+            }
+            getLog().info(
+                    "Project " + artifactProject + " packaged "
+                            + artifactProject.getPackaging());
+            if ((artifactProject != null)
+                    && 
(artifactProject.getPackaging().equals("jbi-component"))) {
+                return artifactInSUPom.getArtifactId();
+            }
+        }
 
         throw new MojoExecutionException(
                 "The service unit "

Modified: 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml
URL: 
http://svn.apache.org/viewvc/servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml?rev=833659&r1=833658&r2=833659&view=diff
==============================================================================
--- 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml
 (original)
+++ 
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml
 Sat Nov  7 09:38:13 2009
@@ -161,5 +161,5 @@
       </configuration>
     </component>
 
-c            m  </components>
+</components>
 </component-set>


Reply via email to