ArtifactRepository localRepo = createLocalArtifactRepository();
log( "Using local repository: " + localRepo.getBasedir(), Project.MSG_VERBOSE );
ArtifactResolver resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
MavenMetadataSource metadataSource = (MavenMetadataSource) lookup( ArtifactMetadataSource.ROLE );
List dependencies = this.dependencies;
Pom pom = buildPom( 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();
}
else
{
// we have to have some sort of Pom object in order to satisfy the requirements for building the
// originating Artifact below...
pom = createDummyPom( localRepo );
}
if ( dependencies.isEmpty() )
{
log( "There were no dependencies specified", Project.MSG_WARN );
}
log( "Resolving dependencies...", Project.MSG_VERBOSE );
ArtifactResolutionResult result;
Set artifacts;
List remoteArtifactRepositories = createRemoteArtifactRepositories( pom.getRepositories() );
try
{
artifacts = MavenMetadataSource.createArtifacts( artifactFactory, dependencies, null, null, null );
Artifact pomArtifact = artifactFactory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom
.getVersion(), pom.getPackaging() );
List listeners = Collections.singletonList( new AntResolutionListener( getProject(), verbose ) );
// TODO: managed dependencies