{
ArtifactRepository localRepo = createLocalArtifactRepository();
ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
MavenMetadataSource metadataSource = (MavenMetadataSource) lookup( ArtifactMetadataSource.ROLE );
List dependencies = this.dependencies;
Pom pom = buildPom( projectBuilder, localRepo );
if ( pom != null )
{
if ( !dependencies.isEmpty() )
{
throw new BuildException( "You cannot specify both dependencies and a pom in the dependencies task" );
}
dependencies = pom.getDependencies();
for ( Iterator i = pom.getRepositories().iterator(); i.hasNext(); )
{
Repository pomRepository = (Repository) i.next();
remoteRepositories.add( createAntRemoteRepository( pomRepository ) );
}
}
else
{
// we have to have some sort of Pom object in order to satisfy the requirements for building the
// originating Artifact below...
pom = createDummyPom();
}
if ( dependencies.isEmpty() )
{
log( "There were no dependencies specified", Project.MSG_WARN );
}
log( "Resolving dependencies...", Project.MSG_VERBOSE );
WagonManager wagonManager = (WagonManager) lookup( WagonManager.ROLE );
wagonManager.setDownloadMonitor( new AntDownloadMonitor() );
ArtifactResolutionResult result;
Set artifacts;
try
{
artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies, null, null, null );
Artifact pomArtifact = artifactFactory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom
.getVersion(), pom.getPackaging() );
List listeners = Collections.EMPTY_LIST;
if ( verbose )
{