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:
Kenney Westerhof 2007-01-19 17:56:16 +00:00
parent c98ee0a930
commit 6c2268f0bd
3 changed files with 37 additions and 16 deletions

View File

@ -4,9 +4,20 @@
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 );
}

View File

@ -19,9 +19,8 @@
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 @@
*/
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 static ArtifactFilter createStandardFilter()
// 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 void excludeArtifact( String artifactId )
{
excludedArtifacts.add( artifactId );
}
}

View File

@ -354,9 +354,8 @@ private Set getPluginArtifacts( Artifact pluginArtifact,
try
{
projectPluginDependencies = MavenMetadataSource.createArtifacts( artifactFactory, plugin.getDependencies(), null,
coreArtifactFilterManager.getArtifactFilter(), project );
coreArtifactFilterManager.getCoreArtifactFilter(), project );
}
catch ( InvalidDependencyVersionException e )
{
@ -439,7 +438,7 @@ private Set getPluginArtifacts( Artifact pluginArtifact,
}
}
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;
}