mirror of https://github.com/apache/maven.git
Only filter core artifacts from plugins, not extension artifacts, as they may break the plugin by bringing in incompatible API artifacts
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@497888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c98ee0a930
commit
6c2268f0bd
|
@ -4,9 +4,20 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
|||
|
||||
public interface ArtifactFilterManager
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a filter for core + extension artifacts.
|
||||
*/
|
||||
ArtifactFilter getArtifactFilter();
|
||||
|
||||
void excludeArtifact( String artifactId );
|
||||
/**
|
||||
* Returns a filter for only the core artifacts.
|
||||
*/
|
||||
ArtifactFilter getCoreArtifactFilter();
|
||||
|
||||
/**
|
||||
* Exclude an extension artifact (doesn't affect getArtifactFilter's result,
|
||||
* only getExtensionArtifactFilter).
|
||||
* @param artifactId
|
||||
*/
|
||||
void excludeArtifact( String artifactId );
|
||||
}
|
|
@ -19,9 +19,8 @@ package org.apache.maven;
|
|||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
|
@ -30,9 +29,9 @@ import java.util.HashSet;
|
|||
*/
|
||||
public class DefaultArtifactFilterManager implements ArtifactFilterManager
|
||||
{
|
||||
|
||||
|
||||
private static final Set DEFAULT_EXCLUSIONS;
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
Set artifacts = new HashSet();
|
||||
|
@ -65,12 +64,12 @@ public class DefaultArtifactFilterManager implements ArtifactFilterManager
|
|||
artifacts.add( "wagon-http-lightweight" );
|
||||
artifacts.add( "wagon-ssh" );
|
||||
artifacts.add( "wagon-ssh-external" );
|
||||
|
||||
|
||||
DEFAULT_EXCLUSIONS = artifacts;
|
||||
}
|
||||
|
||||
|
||||
private Set excludedArtifacts = new HashSet( DEFAULT_EXCLUSIONS );
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use this class as a component instead, and then use getArtifactFilter().
|
||||
*/
|
||||
|
@ -79,15 +78,27 @@ public class DefaultArtifactFilterManager implements ArtifactFilterManager
|
|||
// TODO: configure this from bootstrap or scan lib
|
||||
return new ExclusionSetFilter( DEFAULT_EXCLUSIONS );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/**
|
||||
* Returns the artifact filter for the core + extension artifacts.
|
||||
*
|
||||
* @see org.apache.maven.ArtifactFilterManager#getArtifactFilter()
|
||||
*/
|
||||
public ArtifactFilter getArtifactFilter()
|
||||
{
|
||||
return new ExclusionSetFilter( excludedArtifacts );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the artifact filter for the standard core artifacts.
|
||||
*
|
||||
* @see org.apache.maven.ArtifactFilterManager#getExtensionArtifactFilter()
|
||||
*/
|
||||
public ArtifactFilter getCoreArtifactFilter()
|
||||
{
|
||||
return new ExclusionSetFilter( DEFAULT_EXCLUSIONS );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.maven.ArtifactFilterManager#excludeArtifact(java.lang.String)
|
||||
*/
|
||||
|
@ -95,5 +106,5 @@ public class DefaultArtifactFilterManager implements ArtifactFilterManager
|
|||
{
|
||||
excludedArtifacts.add( artifactId );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -354,9 +354,8 @@ public class DefaultPluginManager
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
projectPluginDependencies = MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null,
|
||||
coreArtifactFilterManager.getArtifactFilter(), project );
|
||||
coreArtifactFilterManager.getCoreArtifactFilter(), project );
|
||||
}
|
||||
catch ( InvalidDependencyVersionException e )
|
||||
{
|
||||
|
@ -439,7 +438,7 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
getLogger().info( "Using the following artifacts for classpath of: " + pluginArtifact.getId() + ":\n\n" + allResolved.toString().replace( ',', '\n' ) );
|
||||
getLogger().debug( "Using the following artifacts for classpath of: " + pluginArtifact.getId() + ":\n\n" + allResolved.toString().replace( ',', '\n' ) );
|
||||
|
||||
return allResolved;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue