dependencies.addAll( rgArtifacts );
// Make sure that we do not influence the dependenecy resolution of extensions with the project's
// dependencyManagement
ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, project.getArtifact(),
Collections.EMPTY_MAP,
//project.getManagedVersionMap(),
localRepository,
project.getRemoteArtifactRepositories(),
artifactMetadataSource, filter );
// gross hack for some backwards compat (MNG-2749)
// if it is a lone artifact, then we assume it to be a resource package, and put it in the main container
// as before. If it has dependencies, that's when we risk conflict and exile to the child container
// jvz: we have to make this 2 because plexus is always added now.
Set artifacts = result.getArtifacts();
// Lifecycles are loaded by the Lifecycle executor by looking up lifecycle definitions from the
// core container. So we need to look if an extension has a lifecycle mapping and use the container
// and not an extension container. (MNG-2831)
if ( extensionContainsLifeycle( artifact.getFile() ) )
{
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
if ( artifactFilter.include( a ) )
{
getLogger().debug( "Adding extension to core container: " + a.getFile() );
container.addJarResource( a.getFile() );
}
}
}
else if ( artifacts.size() == 2 )
{
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
if ( !a.getArtifactId().equals( "plexus-utils" ) )
{
a = project.replaceWithActiveArtifact( a );
getLogger().debug( "Adding extension to core container: " + a.getFile() );
container.addJarResource( a.getFile() );
}
}
}
else
{
// create a child container for the extension
// TODO: this could surely be simpler/different on trunk with the new classworlds
if ( extensionContainer == null )
{
extensionContainer = createContainer();
}
for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
a = project.replaceWithActiveArtifact( a );