DependencyFilter resolutionFilter =
new ExclusionsDependencyFilter( artifactFilterManager.getCoreArtifactExcludes() );
resolutionFilter = AndDependencyFilter.newInstance( resolutionFilter, dependencyFilter );
resolutionFilter = new AndDependencyFilter( collectionFilter, resolutionFilter );
DependencyNode node;
try
{
DependencySelector selector =
AndDependencySelector.newInstance( session.getDependencySelector(), new WagonExcluder() );
DependencyGraphTransformer transformer =
ChainedDependencyGraphTransformer.newInstance( session.getDependencyGraphTransformer(),
new PlexusUtilsInjector() );
DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
pluginSession.setDependencySelector( selector );
pluginSession.setDependencyGraphTransformer( transformer );
CollectRequest request = new CollectRequest();
request.setRequestContext( REPOSITORY_CONTEXT );
request.setRepositories( repositories );
request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) );
for ( Dependency dependency : plugin.getDependencies() )
{
org.eclipse.aether.graph.Dependency pluginDep =
RepositoryUtils.toDependency( dependency, session.getArtifactTypeRegistry() );
if ( !JavaScopes.SYSTEM.equals( pluginDep.getScope() ) )
{
pluginDep = pluginDep.setScope( JavaScopes.RUNTIME );
}
request.addDependency( pluginDep );
}
DependencyRequest depRequest = new DependencyRequest( request, resolutionFilter );
depRequest.setTrace( trace );
request.setTrace( RequestTrace.newChild( trace, depRequest ) );
node = repoSystem.collectDependencies( pluginSession, request ).getRoot();
if ( logger.isDebugEnabled() )
{
node.accept( new GraphLogger() );
}
depRequest.setRoot( node );
repoSystem.resolveDependencies( session, depRequest );
}