if ( getDependencyRefsBuildFile() == null || getDependencyRefsBuildFile().equals( "default" ) )
{
setDependencyRefsBuildFile( DEFAULT_ANT_BUILD_FILE );
}
log( "Building ant file: " + getDependencyRefsBuildFile() );
AntBuildWriter antBuildWriter = new AntBuildWriter();
File antBuildFile = FileUtils.resolveFile( getProject().getBaseDir(), getDependencyRefsBuildFile() );
try
{
antBuildWriter.openAntBuild( antBuildFile, "maven-dependencies", "init-dependencies" );
antBuildWriter.openTarget( "init-dependencies" );
antBuildWriter.writeEcho( "Loading dependency paths from file: " + antBuildFile.getAbsolutePath() );
for ( Iterator<Artifact> i = result.getArtifacts().iterator(); i.hasNext(); )
{
Artifact artifact = i.next();
String conflictId = artifact.getDependencyConflictId();
antBuildWriter.writeProperty( conflictId, artifact.getFile().getAbsolutePath() );
FileSet singleArtifactFileSet = (FileSet) getProject().getReference( conflictId );
antBuildWriter.writeFileSet( singleArtifactFileSet, conflictId );
}
if ( pathId != null )
{
Path thePath = (Path) getProject().getReference( pathId );
antBuildWriter.writePath( thePath, pathId );
}
if ( filesetId != null )
{
antBuildWriter.writeFileSet( dependencyFileSet, filesetId );
}
if ( sourcesFilesetId != null )
{
antBuildWriter.writeFileSet( sourcesFileSet, sourcesFilesetId );
}
if ( javadocFilesetId != null )
{
antBuildWriter.writeFileSet( sourcesFileSet, javadocFilesetId );
}
String versionsList = getProject().getProperty( versionsId );
if ( versionsList != null )
{
antBuildWriter.writeProperty( versionsId, versionsList );
}
antBuildWriter.closeTarget();
antBuildWriter.closeAntBuild();
}
catch ( IOException e )
{
throw new BuildException ( "Unable to write ant build: " + e);
}