You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/06/18 09:37:46 UTC

[camel] branch master updated (15ff17b -> 5589660)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 15ff17b  Polish endpoint DSL to add javadoc and to use SimpleBuilder to not import model in the DSL.
     new 7e8c284  Polished
     new 5589660  Do not use deprecated maven api

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/camel/maven/AutowireMojo.java  | 53 ++--------------------
 1 file changed, 4 insertions(+), 49 deletions(-)


[camel] 02/02: Do not use deprecated maven api

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 55896604dcfe26fefe707946af57978b616a353a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 18 11:36:26 2019 +0200

    Do not use deprecated maven api
---
 .../java/org/apache/camel/maven/AutowireMojo.java  | 50 ++--------------------
 1 file changed, 4 insertions(+), 46 deletions(-)

diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
index 621866e..d61c00a 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
@@ -46,16 +46,10 @@ import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.OrderedProperties;
 import org.apache.camel.util.StringHelper;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Exclusion;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Component;
@@ -64,6 +58,7 @@ import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.mojo.exec.AbstractExecMojo;
 import org.reflections.Reflections;
 import org.reflections.scanners.SubTypesScanner;
@@ -123,7 +118,7 @@ public class AutowireMojo extends AbstractExecMojo {
     private boolean downloadVersion;
 
     @Component
-    private ArtifactFactory artifactFactory;
+    private RepositorySystem repositorySystem;
 
     @Component
     private ArtifactResolver artifactResolver;
@@ -488,49 +483,12 @@ public class AutowireMojo extends AbstractExecMojo {
     }
 
     // generic method to retrieve all the transitive dependencies
-    private Collection<Artifact> getAllDependencies() throws MojoExecutionException {
+    private Collection<Artifact> getAllDependencies() {
         List<Artifact> artifacts = new ArrayList<>();
 
         for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
             Dependency dependency = (Dependency)dependencies.next();
-
-            String groupId = dependency.getGroupId();
-            String artifactId = dependency.getArtifactId();
-
-            VersionRange versionRange;
-            try {
-                versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());
-            } catch (InvalidVersionSpecificationException e) {
-                throw new MojoExecutionException("unable to parse version", e);
-            }
-
-            String type = dependency.getType();
-            if (type == null) {
-                type = "jar";
-            }
-            String classifier = dependency.getClassifier();
-            boolean optional = dependency.isOptional();
-            String scope = dependency.getScope();
-            if (scope == null) {
-                scope = Artifact.SCOPE_COMPILE;
-            }
-
-            Artifact art = this.artifactFactory.createDependencyArtifact(groupId, artifactId, versionRange,
-                    type, classifier, scope, null, optional);
-
-            if (scope.equalsIgnoreCase(Artifact.SCOPE_SYSTEM)) {
-                art.setFile(new File(dependency.getSystemPath()));
-            }
-
-            List<String> exclusions = new ArrayList<>();
-            for (Exclusion exclusion : dependency.getExclusions()) {
-                exclusions.add(exclusion.getGroupId() + ":" + exclusion.getArtifactId());
-            }
-
-            ArtifactFilter newFilter = new ExcludesArtifactFilter(exclusions);
-
-            art.setDependencyFilter(newFilter);
-
+            Artifact art = repositorySystem.createDependencyArtifact(dependency);
             artifacts.add(art);
         }
 


[camel] 01/02: Polished

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 7e8c28409ed99858f93ff1d9927233f649d7af3e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 18 11:28:42 2019 +0200

    Polished
---
 .../src/main/java/org/apache/camel/maven/AutowireMojo.java             | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
index 8f936b4..621866e 100644
--- a/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
+++ b/catalog/camel-main-maven-plugin/src/main/java/org/apache/camel/maven/AutowireMojo.java
@@ -136,9 +136,6 @@ public class AutowireMojo extends AbstractExecMojo {
 
     private transient ClassLoader classLoader;
 
-    // TODO: Allow to configure known types in xml config, or refer to external file
-
-    // CHECKSTYLE:OFF
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         CamelCatalog catalog = new DefaultCamelCatalog();