You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2011/12/19 12:36:10 UTC

svn commit: r1220697 - in /sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport: AttachBundleListMojo.java AttachPartialBundleListMojo.java

Author: cziegeler
Date: Mon Dec 19 11:36:09 2011
New Revision: 1220697

URL: http://svn.apache.org/viewvc?rev=1220697&view=rev
Log:
SLING-2332 : Partial bundle list should be attachable to any maven project

Modified:
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java?rev=1220697&r1=1220696&r2=1220697&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java (original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java Mon Dec 19 11:36:09 2011
@@ -38,10 +38,6 @@ import org.codehaus.plexus.util.FileUtil
  */
 public class AttachBundleListMojo extends AbstractUsingBundleListMojo {
 
-    private static final String CLASSIFIER = "bundlelist";
-
-    private static final String TYPE = "xml";
-
     /**
      * @parameter default-value="${project.build.directory}/bundleList.xml"
      */
@@ -67,7 +63,7 @@ public class AttachBundleListMojo extend
         try {
             fw = new FileWriter(outputFile);
             writer.write(fw, getInitializedBundleList());
-            projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
+            projectHelper.attachArtifact(project, AttachPartialBundleListMojo.TYPE, AttachPartialBundleListMojo.CLASSIFIER, outputFile);
         } catch (IOException e) {
             throw new MojoExecutionException("Unable to output effective bundle list", e);
         } finally {

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java?rev=1220697&r1=1220696&r2=1220697&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java (original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java Mon Dec 19 11:36:09 2011
@@ -46,6 +46,10 @@ public class AttachPartialBundleListMojo
 
     public static final String CONFIG_TYPE = "zip";
 
+    public static final String CLASSIFIER = "bundlelist";
+
+    public static final String TYPE = "xml";
+
     public static final String SLING_COMMON_PROPS = "common.properties";
 
     public static final String SLING_COMMON_BOOTSTRAP = "common.bootstrap.txt";
@@ -100,7 +104,13 @@ public class AttachPartialBundleListMojo
             throw new MojoExecutionException("Unable to write bundle list", e);
         }
 
-        project.getArtifact().setFile(bundleListOutput);
+        // if this project is a partial bundle list, it's the main artifact
+        if ( project.getPackaging().equals(PARTIAL) ) {
+            project.getArtifact().setFile(bundleListOutput);
+        } else {
+            // otherwise attach it as an additional artifact
+            projectHelper.attachArtifact(project, TYPE, CLASSIFIER, bundleListOutput);
+        }
 
         this.getLog().info("Attaching bundle list configuration");
         try {