camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astefanu...@apache.org
Subject [1/3] camel git commit: Support adding direct Camel plugin dependencies to classpath
Date Thu, 03 Mar 2016 14:18:45 GMT
Repository: camel
Updated Branches:
  refs/heads/master 0a890e35e -> 664562d3c


Support adding direct Camel plugin dependencies to classpath


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

Branch: refs/heads/master
Commit: b784eda396913722ef773028286b0f98eabee939
Parents: 0a890e3
Author: Antonin Stefanutti <antonin@stefanutti.fr>
Authored: Thu Mar 3 14:55:37 2016 +0100
Committer: Antonin Stefanutti <antonin@stefanutti.fr>
Committed: Thu Mar 3 14:55:37 2016 +0100

----------------------------------------------------------------------
 tooling/maven/camel-maven-plugin/pom.xml        | 12 ++++++++++
 .../java/org/apache/camel/maven/RunMojo.java    | 23 ++++++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b784eda3/tooling/maven/camel-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-maven-plugin/pom.xml b/tooling/maven/camel-maven-plugin/pom.xml
index 09574a2..ee4777d 100644
--- a/tooling/maven/camel-maven-plugin/pom.xml
+++ b/tooling/maven/camel-maven-plugin/pom.xml
@@ -35,6 +35,18 @@
     <dependency>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>exec-maven-plugin</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-plugin-descriptor</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- As Camel requires Maven 3.x we can depend on an updated version of the plugin
API -->
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>3.1.1</version>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/b784eda3/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
index e30359d..48d7839 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
@@ -49,6 +49,7 @@ import org.apache.maven.model.Exclusion;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.artifact.MavenMetadataSource;
@@ -922,8 +923,26 @@ public class RunMojo extends AbstractExecMojo {
                 relevantDependencies = this.resolveExecutableDependencies(executablePomArtifact,
false);
             }
         } else {
-            relevantDependencies = Collections.emptySet();
-            getLog().debug("Plugin Dependencies will be excluded.");
+            getLog().debug("Only Direct Plugin Dependencies will be included.");
+            PluginDescriptor descriptor = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
+            try {
+                relevantDependencies = artifactResolver
+                    .resolveTransitively(MavenMetadataSource
+                        .createArtifacts(this.artifactFactory,
+                            descriptor.getPlugin().getDependencies(),
+                            null, null, null),
+                        this.project.getArtifact(),
+                        Collections.emptyMap(),
+                        this.localRepository,
+                        this.remoteRepositories,
+                        metadataSource,
+                        new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME),
+                        Collections.emptyList())
+                    .getArtifacts();
+            } catch (Exception ex) {
+                throw new MojoExecutionException("Encountered problems resolving dependencies
of the plugin "
+                    + "in preparation for its execution.", ex);
+            }
         }
         return relevantDependencies;
     }


Mime
View raw message