Repository: maven Updated Branches: refs/heads/master cc5af1306 -> ead960adb
[MNG-6135] Maven plugins are not dependencies, they should be resolved the same way as projects. o Updated to support the POM resolution case. Does not change anything because these classes currently are not used in a POM resolution scenario. In cases these classes will be used in a POM resolution scenario, they would work out of the box with these changes. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/ead960ad Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/ead960ad Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/ead960ad Branch: refs/heads/master Commit: ead960adbc28b7e191449e2712ca9766cf0ec96c Parents: cc5af13 Author: Christian Schulte <[email protected]> Authored: Sat Dec 17 03:07:04 2016 +0100 Committer: Christian Schulte <[email protected]> Committed: Sat Dec 17 03:08:55 2016 +0100 ---------------------------------------------------------------------- .../java/org/apache/maven/RepositoryUtils.java | 12 ++++--- .../plugin/internal/PlexusUtilsInjector.java | 33 +++++++++++++------- .../maven/plugin/internal/WagonExcluder.java | 15 ++++++--- 3 files changed, 40 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/ead960ad/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java index 52442b7..08749ea 100644 --- a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java +++ b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java @@ -114,12 +114,16 @@ public class RepositoryUtils List<String> nodeTrail = new ArrayList<>( trail.size() + 1 ); nodeTrail.addAll( trail ); - nodeTrail.add( artifact.getId() ); - if ( filter == null || filter.accept( node, Collections.<DependencyNode>emptyList() ) ) + if ( artifact != null ) { - artifact.setDependencyTrail( nodeTrail ); - artifacts.add( artifact ); + nodeTrail.add( artifact.getId() ); + + if ( filter == null || filter.accept( node, Collections.<DependencyNode>emptyList() ) ) + { + artifact.setDependencyTrail( nodeTrail ); + artifacts.add( artifact ); + } } toArtifacts( artifacts, node.getChildren(), nodeTrail, filter ); http://git-wip-us.apache.org/repos/asf/maven/blob/ead960ad/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java index 16a0b63..a69633f 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java @@ -64,24 +64,35 @@ class PlexusUtilsInjector private DependencyNode findPlexusUtils( DependencyNode node ) { - Artifact artifact = node.getDependency().getArtifact(); + DependencyNode plexusUtils = null; - if ( AID.equals( artifact.getArtifactId() ) && GID.equals( artifact.getGroupId() ) - && EXT.equals( artifact.getExtension() ) && "".equals( artifact.getClassifier() ) ) + find: { - return node; - } + if ( node.getDependency() != null ) + { + Artifact artifact = node.getDependency().getArtifact(); - for ( DependencyNode child : node.getChildren() ) - { - DependencyNode result = findPlexusUtils( child ); - if ( result != null ) + if ( AID.equals( artifact.getArtifactId() ) && GID.equals( artifact.getGroupId() ) + && EXT.equals( artifact.getExtension() ) && "".equals( artifact.getClassifier() ) ) + { + plexusUtils = node; + break find; + } + } + + for ( DependencyNode child : node.getChildren() ) { - return result; + DependencyNode result = findPlexusUtils( child ); + + if ( result != null ) + { + plexusUtils = result; + break find; + } } } - return null; + return plexusUtils; } } http://git-wip-us.apache.org/repos/asf/maven/blob/ead960ad/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java index 43e8cfc..8c21405 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java @@ -51,19 +51,24 @@ class WagonExcluder public boolean selectDependency( Dependency dependency ) { - return !coreArtifact || !isWagonProvider( dependency.getArtifact() ); + return !( coreArtifact && isWagonProvider( dependency.getArtifact() ) ); } public DependencySelector deriveChildSelector( DependencyCollectionContext context ) { - if ( coreArtifact || !isLegacyCoreArtifact( context.getDependency().getArtifact() ) ) + WagonExcluder child = this; + + if ( context.getDependency() == null && this.coreArtifact ) { - return this; + child = new WagonExcluder( false ); } - else + if ( context.getDependency() != null && !this.coreArtifact + && isLegacyCoreArtifact( context.getDependency().getArtifact() ) ) { - return new WagonExcluder( true ); + child = new WagonExcluder( true ); } + + return child; } private boolean isLegacyCoreArtifact( Artifact artifact )
