mirror of https://github.com/apache/maven.git
Merged from 433788 on the branch, to fix the case where build extensions don't get resolved when building projects that would be filtered by Maven's core artifact filter...as in the case of some plexus projects, and of maven projects themselves.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@433789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21b94a2dab
commit
e165438db3
|
@ -65,12 +65,14 @@ public class DefaultExtensionManager
|
|||
|
||||
if ( artifact != null )
|
||||
{
|
||||
ArtifactFilter filter = new ProjectArtifactExceptionFilter( artifactFilter, project.getArtifact() );
|
||||
|
||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively( Collections.singleton( artifact ),
|
||||
project.getArtifact(),
|
||||
localRepository,
|
||||
project.getRemoteArtifactRepositories(),
|
||||
artifactMetadataSource,
|
||||
artifactFilter );
|
||||
filter );
|
||||
for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
|
||||
{
|
||||
Artifact a = (Artifact) i.next();
|
||||
|
@ -87,4 +89,23 @@ public class DefaultExtensionManager
|
|||
{
|
||||
this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||
}
|
||||
|
||||
private static final class ProjectArtifactExceptionFilter implements ArtifactFilter
|
||||
{
|
||||
private ArtifactFilter passThroughFilter;
|
||||
private String projectDependencyConflictId;
|
||||
|
||||
ProjectArtifactExceptionFilter( ArtifactFilter passThroughFilter, Artifact projectArtifact )
|
||||
{
|
||||
this.passThroughFilter = passThroughFilter;
|
||||
this.projectDependencyConflictId = projectArtifact.getDependencyConflictId();
|
||||
}
|
||||
|
||||
public boolean include(Artifact artifact) {
|
||||
String depConflictId = artifact.getDependencyConflictId();
|
||||
|
||||
return projectDependencyConflictId.equals( depConflictId )
|
||||
|| passThroughFilter.include( artifact );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue