[MNG-4277] Remove core artifacts from ${plugin.artifacts}

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@800140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-02 19:39:21 +00:00
parent db0e7f7407
commit 898653d5fc
2 changed files with 16 additions and 5 deletions

View File

@ -299,6 +299,7 @@ public class DefaultPluginManager
else
{
artifact.setFile( null );
artifact.setResolved( false );
}
}
@ -432,6 +433,8 @@ public class DefaultPluginManager
logger.debug( "Populating plugin realm for " + constructPluginKey( plugin ) );
}
List<Artifact> exposedPluginArtifacts = new ArrayList<Artifact>();
for ( Artifact a : pluginArtifacts )
{
if ( a.getFile() != null )
@ -441,6 +444,8 @@ public class DefaultPluginManager
logger.debug( " Included: " + a.getId() );
}
exposedPluginArtifacts.add( a );
try
{
pluginRealm.addURL( a.getFile().toURI().toURL() );
@ -460,8 +465,8 @@ public class DefaultPluginManager
}
pluginDescriptor.setClassRealm( pluginRealm );
pluginDescriptor.setArtifacts( pluginArtifacts );
pluginDescriptor.setArtifacts( exposedPluginArtifacts );
try
{
for ( ComponentDescriptor componentDescriptor : pluginDescriptor.getComponents() )
@ -481,8 +486,8 @@ public class DefaultPluginManager
throw new PluginManagerException( plugin, e.getMessage(), e );
}
pluginCache.put( plugin, localRepository, remoteRepositories, pluginRealm, pluginArtifacts );
pluginCache.put( plugin, localRepository, remoteRepositories, pluginRealm, exposedPluginArtifacts );
return pluginRealm;
}

View File

@ -227,6 +227,12 @@ public class PluginDescriptor
this.inheritedByDefault = inheritedByDefault;
}
/**
* Gets the artifacts that make up the plugin's class realm, excluding artifacts shadowed by the Maven core realm
* like {@code maven-project}.
*
* @return The plugin artifacts, never {@code null}.
*/
public List<Artifact> getArtifacts()
{
return artifacts;
@ -277,7 +283,7 @@ public class PluginDescriptor
MojoDescriptor mojoDescriptor = null;
for ( Iterator i = getMojos().iterator(); i.hasNext() && mojoDescriptor == null; )
for ( Iterator<?> i = getMojos().iterator(); i.hasNext() && mojoDescriptor == null; )
{
MojoDescriptor desc = (MojoDescriptor) i.next();