From 95632cef43819559771a54c06eb35569e81cb214 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 6 Aug 2009 18:30:33 +0000 Subject: [PATCH] [MNG-3769] [regression] Excluding relocated transitive dependencies does not work o Merged from r736543 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@801760 13f79535-47bb-0310-9956-ffa450edef68 --- .../resolver/DefaultLegacyArtifactCollector.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java index 872ac123ea..470f6f4e7c 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -382,6 +382,8 @@ public class DefaultLegacyArtifactCollector { fireEvent( ResolutionListener.PROCESS_CHILDREN, listeners, node ); + Artifact parentArtifact = node.getArtifact(); + for ( Iterator i = node.getChildrenIterator(); i.hasNext(); ) { ResolutionNode child = (ResolutionNode) i.next(); @@ -493,6 +495,17 @@ public class DefaultLegacyArtifactCollector } while( !childKey.equals( child.getKey() ) ); + if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null + && !parentArtifact.getDependencyFilter().include( artifact ) ) + { + // MNG-3769: the [probably relocated] artifact is excluded. + // We could process exclusions on relocated artifact details in the + // MavenMetadataSource.createArtifacts(..) step, BUT that would + // require resolving the POM from the repository very early on in + // the build. + continue; + } + artifact.setDependencyTrail( node.getDependencyTrail() ); ResolutionGroup rGroup = source.retrieve( artifact, localRepository, childRemoteRepositories );