mirror of https://github.com/apache/maven.git
[MNG-4196] [regression] Exclusions in project-level plugin dependencies are ignored
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@784371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cb7055ea31
commit
2a9cd6f73d
|
@ -261,10 +261,6 @@ public class DefaultPluginManager
|
|||
// defined dependencies and then the result is merged with the overrides. The overrides don't pass through the metadata source which is where the
|
||||
// Artifact.setFile( file ) method is called. We should eventually take care of this in the resolver.
|
||||
Artifact a = repositorySystem.createDependencyArtifact( dependencySpecifiedInProject );
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
|
||||
{
|
||||
a.setFile( new File( dependencySpecifiedInProject.getSystemPath() ) );
|
||||
}
|
||||
dependenciesToResolveForPlugin.add( a );
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.apache.maven.artifact.ArtifactUtils;
|
|||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
|
||||
import org.apache.maven.artifact.versioning.ManagedVersionMap;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.CiManagement;
|
||||
|
@ -45,7 +44,6 @@ import org.apache.maven.model.Dependency;
|
|||
import org.apache.maven.model.DependencyManagement;
|
||||
import org.apache.maven.model.Developer;
|
||||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
import org.apache.maven.model.Extension;
|
||||
import org.apache.maven.model.IssueManagement;
|
||||
import org.apache.maven.model.License;
|
||||
|
@ -1541,35 +1539,6 @@ public class MavenProject
|
|||
map = Collections.emptyMap();
|
||||
}
|
||||
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && ( d.getSystemPath() != null ) )
|
||||
{
|
||||
artifact.setFile( new File( d.getSystemPath() ) );
|
||||
}
|
||||
|
||||
// If the dependencyManagement section listed exclusions,
|
||||
// add them to the managed artifacts here so that transitive
|
||||
// dependencies will be excluded if necessary.
|
||||
|
||||
if ( ( null != d.getExclusions() ) && !d.getExclusions().isEmpty() )
|
||||
{
|
||||
List<String> exclusions = new ArrayList<String>();
|
||||
|
||||
for ( Iterator<Exclusion> j = d.getExclusions().iterator(); j.hasNext(); )
|
||||
{
|
||||
Exclusion e = j.next();
|
||||
|
||||
exclusions.add( e.getGroupId() + ":" + e.getArtifactId() );
|
||||
}
|
||||
|
||||
ExcludesArtifactFilter eaf = new ExcludesArtifactFilter( exclusions );
|
||||
|
||||
artifact.setDependencyFilter( eaf );
|
||||
}
|
||||
else
|
||||
{
|
||||
artifact.setDependencyFilter( null );
|
||||
}
|
||||
|
||||
map.put( d.getManagementKey(), artifact );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,8 @@ public class MavenMetadataSource
|
|||
dependencyArtifact = repositorySystem.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), effectiveScope, d.getType() );
|
||||
}
|
||||
|
||||
dependencyArtifact.setScope( effectiveScope );
|
||||
|
||||
if ( dependencyFilter == null || dependencyFilter.include( dependencyArtifact ) )
|
||||
{
|
||||
dependencyArtifact.setOptional( d.isOptional() );
|
||||
|
|
|
@ -34,9 +34,11 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
|||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||
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.model.Plugin;
|
||||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.model.RepositoryPolicy;
|
||||
|
@ -114,7 +116,28 @@ public class LegacyRepositorySystem
|
|||
return null;
|
||||
}
|
||||
|
||||
return artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope() );
|
||||
Artifact artifact =
|
||||
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(),
|
||||
d.getClassifier(), d.getScope(), d.isOptional() );
|
||||
|
||||
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null )
|
||||
{
|
||||
artifact.setFile( new File( d.getSystemPath() ) );
|
||||
}
|
||||
|
||||
if ( !d.getExclusions().isEmpty() )
|
||||
{
|
||||
List<String> exclusions = new ArrayList<String>();
|
||||
|
||||
for ( Exclusion exclusion : d.getExclusions() )
|
||||
{
|
||||
exclusions.add( exclusion.getGroupId() + ':' + exclusion.getArtifactId() );
|
||||
}
|
||||
|
||||
artifact.setDependencyFilter( new ExcludesArtifactFilter( exclusions ) );
|
||||
}
|
||||
|
||||
return artifact;
|
||||
}
|
||||
|
||||
public Artifact createExtensionArtifact( String groupId, String artifactId, String version )
|
||||
|
|
Loading…
Reference in New Issue