incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1241825 - /sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
Date Wed, 08 Feb 2012 09:10:59 GMT
Author: cziegeler
Date: Wed Feb  8 09:10:58 2012
New Revision: 1241825

URL: http://svn.apache.org/viewvc?rev=1241825&view=rev
Log:
SLING-2404 : maven-sling-plugin install-file goal needs to support Maven artifacts that use
classifiers in their coordinates. Applied patch from Craig S. Dickson

Modified:
    sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java

Modified: sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java?rev=1241825&r1=1241824&r2=1241825&view=diff
==============================================================================
--- sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
(original)
+++ sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
Wed Feb  8 09:10:58 2012
@@ -74,7 +74,13 @@ public class BundleInstallFileMojo exten
     private String packaging = "jar";
 
     /**
-     * A string of the form groupId:artifactId:version[:packaging].
+     * The classifier of the artifact to install
+     * @parameter expression="${sling.classifier}"
+     */
+    private String classifier;
+
+    /**
+     * A string of the form groupId:artifactId:version[:packaging[:classifier]].
      * @parameter expression="${sling.artifact}"
      */
     private String artifact;
@@ -128,7 +134,7 @@ public class BundleInstallFileMojo exten
      * @readonly
      */
     private ArtifactRepository localRepository;
-    
+
     @Override
     protected String getBundleFileName() throws MojoExecutionException {
         String fileName = bundleFileName;
@@ -139,7 +145,7 @@ public class BundleInstallFileMojo exten
                 throw new MojoExecutionException("Must provide either sling.file or sling.artifact
parameters");
             }
         }
-        
+
         return fileName;
     }
 
@@ -150,17 +156,19 @@ public class BundleInstallFileMojo exten
         }
         if (artifactId == null) {
             String[] tokens = StringUtils.split(artifact, ":");
-            if (tokens.length != 3 && tokens.length != 4) {
+            if (tokens.length != 3 && tokens.length != 4 && tokens.length
!= 5) {
                 throw new MojoExecutionException("Invalid artifact, you must specify "
-                        + "groupId:artifactId:version[:packaging] " + artifact);
+                        + "groupId:artifactId:version[:packaging[:classifier]] " + artifact);
             }
             groupId = tokens[0];
             artifactId = tokens[1];
             version = tokens[2];
-            if (tokens.length == 4)
+            if (tokens.length >= 4)
                 packaging = tokens[3];
+            if (tokens.length == 5)
+                classifier = tokens[4];
         }
-        Artifact packageArtifact = artifactFactory.createBuildArtifact(groupId, artifactId,
version, packaging);
+        Artifact packageArtifact = artifactFactory.createArtifactWithClassifier(groupId,
artifactId, version, packaging, classifier);
 
         if (pomRemoteRepositories == null) {
             pomRemoteRepositories = new ArrayList();



Mime
View raw message