activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: renaming/equalizing parameters on the maven plugins
Date Wed, 07 Oct 2015 15:52:40 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master e81f63f06 -> c21bee63c


renaming/equalizing parameters on the maven plugins


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c21bee63
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c21bee63
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c21bee63

Branch: refs/heads/master
Commit: c21bee63cb97df46715764a17ed1e32807e4d1d3
Parents: e81f63f
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Oct 7 11:36:26 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Oct 7 11:51:53 2015 -0400

----------------------------------------------------------------------
 .../artemis/maven/ArtemisAbstractPlugin.java    | 28 ++++++++++
 .../artemis/maven/ArtemisCreatePlugin.java      | 36 ++++---------
 .../maven/ArtemisDependencyScanPlugin.java      | 55 +++++++++-----------
 examples/features/sub-modules/aerogear/pom.xml  |  5 +-
 examples/features/sub-modules/vertx/pom.xml     |  5 +-
 5 files changed, 67 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c21bee63/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
index 49f1bf7..e1ec2c6 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
@@ -20,8 +20,10 @@ package org.apache.activemq.artemis.maven;
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.artemis.cli.commands.Configurable;
@@ -145,4 +147,30 @@ public abstract class ArtemisAbstractPlugin extends AbstractMojo {
       return dependencies;
    }
 
+   protected Set<File> resolveDependencies(String[] dependencyListParameter, String[]
individualListParameter) throws DependencyCollectionException, MojoFailureException, MojoExecutionException
{
+      Set<File> filesSet = new HashSet<>();
+      if (dependencyListParameter != null) {
+         for (String lib : dependencyListParameter) {
+            getLog().debug("********************" + lib);
+
+            List<Artifact> artifactsList = explodeDependencies(newArtifact(lib));
+
+            for (Artifact artifact : artifactsList) {
+               File artifactFile = resolveArtifact(artifact);
+               filesSet.add(artifactFile);
+            }
+         }
+      }
+
+      if (individualListParameter != null) {
+         for (String lib : individualListParameter) {
+            Artifact artifact = newArtifact(lib);
+            getLog().debug("Single dpendency resolved::" + artifact);
+            File artifactFile = resolveArtifact(artifact);
+            filesSet.add(artifactFile);
+         }
+      }
+      return filesSet;
+   }
+
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c21bee63/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
index e9f4535..39b6d8e 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
@@ -38,7 +38,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.artifact.Artifact;
 
 @Mojo(name = "create", defaultPhase = LifecyclePhase.VERIFY)
 public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
@@ -120,14 +119,15 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
    @Parameter
    ArrayList<String> args = new ArrayList<>();
 
+   /**
+    * Deprecated, use dependencyList and individualList
+    */
    @Parameter
    private String[] libList;
 
-   /**
-    * copy dependencies listed on libList.
-    */
    @Parameter
-   private boolean copyDependencies;
+   private String[] libListWithDeps;
+
 
    @Parameter(defaultValue = "${localRepository}")
    private org.apache.maven.artifact.repository.ArtifactRepository localRepository;
@@ -290,30 +290,14 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin {
             }
          }
 
-         if (libList != null) {
+         Set<File> files = resolveDependencies(libListWithDeps, libList);
+
+         if (!files.isEmpty() ) {
             commandLineStream.println();
             commandLineStream.println("# This is a list of files that need to be installed
under ./lib.");
             commandLineStream.println("# We are copying them from your maven lib home");
-
-            for (int i = 0; i < libList.length; i++) {
-
-               Artifact artifact = newArtifact(libList[i]);
-               getLog().debug("******************** Artifact::" + artifact);
-
-
-               if (copyDependencies) {
-                  getLog().debug("******************** exploring dependencies::" + artifact);
-                  List<Artifact> dependencies = explodeDependencies(artifact);
-                  for (Artifact artifactItem : dependencies) {
-                     File artifactFile = resolveArtifact(artifactItem);
-                     copyToLib(artifactFile, commandLineStream);
-                  }
-               }
-               else {
-                  File artifactFile = resolveArtifact(artifact);
-                  getLog().debug("*********** coping Artifact:: " + artifact + " file = "
+ artifactFile);
-                  copyToLib(artifactFile, commandLineStream);
-               }
+            for (File file : files) {
+               copyToLib(file, commandLineStream);
             }
          }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c21bee63/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
index 7133574..4ead900 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisDependencyScanPlugin.java
@@ -17,7 +17,8 @@
 package org.apache.activemq.artemis.maven;
 
 import java.io.File;
-import java.util.List;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.Map;
 import java.util.Set;
 
@@ -28,7 +29,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.artifact.Artifact;
 
 @Mojo(name = "dependency-scan", defaultPhase = LifecyclePhase.VERIFY)
 public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin {
@@ -42,17 +42,21 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin
{
    private PluginDescriptor descriptor;
 
    @Parameter
-   private String[] dependencyList;
+   private String[] libListWithDeps;
 
    @Parameter
-   private String[] individualList;
+   private String[] libList;
 
-   @Parameter(required = true)
+   @Parameter
    private String variableName;
 
    @Parameter
    private String pathSeparator = File.pathSeparator;
 
+   /** Where to copy the exploded dependencies. */
+   @Parameter
+   private File targetFolder;
+
    protected boolean isIgnore() {
       return false;
    }
@@ -71,38 +75,30 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin
{
          getLog().info("... key=" + entry.getKey() + " = " + entry.getValue());
       }
 
+
       try {
          StringBuffer buffer = new StringBuffer();
-         String separatorUsed = "";
-         if (dependencyList != null) {
-            for (String lib : dependencyList) {
-               getLog().debug("********************" + lib);
-
-               List<Artifact> artifactsList = explodeDependencies(newArtifact(lib));
-
-               for (Artifact artifact : artifactsList) {
-                  File artifactFile = resolveArtifact(artifact);
-                  buffer.append(separatorUsed);
-                  buffer.append(artifactFile.getAbsolutePath());
-                  separatorUsed = pathSeparator;
-               }
-            }
-         }
+         Set<File> filesSet = resolveDependencies(libListWithDeps, libList);
 
-         if (individualList != null) {
-            for (String lib : individualList) {
-               Artifact artifact = newArtifact(lib);
-               getLog().info("Single dpendency resolved::" + artifact);
-               File artifactFile = resolveArtifact(artifact);
+         if (variableName != null) {
+            String separatorUsed = "";
+            for (File f : filesSet) {
                buffer.append(separatorUsed);
-               buffer.append(artifactFile.getAbsolutePath());
+               buffer.append(f.getAbsolutePath());
                separatorUsed = pathSeparator;
             }
+
+            String classPathGenerated = buffer.toString();
+            project.getProperties().setProperty(variableName, classPathGenerated);
+            getLog().info("dependency-scan setting: " + variableName + "=" + classPathGenerated);
          }
 
-         String classPathGenerated = buffer.toString();
-         project.getProperties().setProperty(variableName, classPathGenerated);
-         getLog().info("dependency-scan setting: " + variableName + "=" + classPathGenerated);
+         if (targetFolder != null) {
+            targetFolder.mkdirs();
+            for (File file : filesSet) {
+               Files.copy(file.toPath(), targetFolder.toPath(), StandardCopyOption.REPLACE_EXISTING);
+            }
+         }
       }
       catch (Throwable e) {
          getLog().error(e);
@@ -110,5 +106,4 @@ public class ArtemisDependencyScanPlugin extends ArtemisAbstractPlugin
{
       }
    }
 
-
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c21bee63/examples/features/sub-modules/aerogear/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/aerogear/pom.xml b/examples/features/sub-modules/aerogear/pom.xml
index 6614782..cb5f0f0 100644
--- a/examples/features/sub-modules/aerogear/pom.xml
+++ b/examples/features/sub-modules/aerogear/pom.xml
@@ -60,10 +60,9 @@ under the License.
                   <configuration>
                      <ignore>${noServer}</ignore>
                      <!-- this list was extracted from mvn dependency:tree on integration/aerogear
-->
-                     <libList>
+                     <libListWithDeps>
                         <param>org.apache.activemq:artemis-aerogear-integration:${project.version}</param>
-                     </libList>
-                     <copyDependencies>true</copyDependencies>
+                     </libListWithDeps>
                   </configuration>
                </execution>
                <execution>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c21bee63/examples/features/sub-modules/vertx/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/sub-modules/vertx/pom.xml b/examples/features/sub-modules/vertx/pom.xml
index a93923b..e4a6c7c 100644
--- a/examples/features/sub-modules/vertx/pom.xml
+++ b/examples/features/sub-modules/vertx/pom.xml
@@ -95,10 +95,9 @@ under the License.
                      <goal>create</goal>
                   </goals>
                   <configuration>
-                     <libList>
+                     <libListWithDeps>
                         <arg>org.apache.activemq.examples.modules:artemis-vertx-example:${project.version}</arg>
-                     </libList>
-                     <copyDependencies>true</copyDependencies>
+                     </libListWithDeps>
 
                      <instance>${basedir}/target/server0</instance>
                      <configuration>${basedir}/target/classes/activemq/server0</configuration>


Mime
View raw message