openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1799337 - /openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
Date Tue, 20 Jun 2017 10:54:12 GMT
Author: rmannibucau
Date: Tue Jun 20 10:54:11 2017
New Revision: 1799337

URL: http://svn.apache.org/viewvc?rev=1799337&view=rev
Log:
MEECROWAVE-42 supporting libs option

Modified:
    openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java?rev=1799337&r1=1799336&r2=1799337&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBundleMojo.java
Tue Jun 20 10:54:11 2017
@@ -209,7 +209,16 @@ public class MeecrowaveBundleMojo extend
             addLib(distroFolder, app);
         }
         if (enforceCommonsCli && !includedArtifacts.contains("commons-cli")) {
-            addLib(distroFolder, resolve("commons-cli", "commons-cli", "1.3.1"));
+            addLib(distroFolder, resolve("commons-cli", "commons-cli", "1.3.1", ""));
+        }
+        if (libs != null) {
+            libs.forEach(l -> {
+                final String[] c = l.split(":");
+                if (c.length != 3 && c.length != 4) {
+                    throw new IllegalArgumentException("libs syntax is groupId:artifactId:version[:classifier]");
+                }
+                addLib(distroFolder, resolve(c[0], c[1], c[2], c.length == 4 ? c[3] : ""));
+            });
         }
         if (enforceMeecrowave && !includedArtifacts.contains("meecrowave-core"))
{
             final DependencyResolutionRequest request = new DefaultDependencyResolutionRequest();
@@ -302,8 +311,8 @@ public class MeecrowaveBundleMojo extend
         }}.getProperty("version", "0.3.2");
     }
 
-    private File resolve(final String group, final String artifact, final String version)
throws MojoExecutionException {
-        final DefaultArtifact art = new DefaultArtifact(group, artifact, "jar", version);
+    private File resolve(final String group, final String artifact, final String version,
final String classifier) {
+        final DefaultArtifact art = new DefaultArtifact(group, artifact, classifier, "jar",
version);
         final ArtifactRequest artifactRequest = new ArtifactRequest().setArtifact(art).setRepositories(remoteRepositories);
 
         final LocalRepositoryManager lrm = session.getLocalRepositoryManager();
@@ -312,11 +321,11 @@ public class MeecrowaveBundleMojo extend
         try {
             final ArtifactResult result = repositorySystem.resolveArtifact(session, artifactRequest);
             if (result.isMissing()) {
-                throw new MojoExecutionException("Can't find commons-cli, please add it to
the pom.");
+                throw new IllegalStateException("Can't find commons-cli, please add it to
the pom.");
             }
             return result.getArtifact().getFile();
         } catch (final ArtifactResolutionException e) {
-            throw new MojoExecutionException(e.getMessage(), e);
+            throw new IllegalStateException(e.getMessage(), e);
         }
     }
 



Mime
View raw message