clean up ant plugin exception handling

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@314945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-12 15:24:33 +00:00
parent 14db4338c1
commit e8540568ae
2 changed files with 6 additions and 30 deletions

View File

@ -20,13 +20,13 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Repository;
import org.apache.maven.model.Resource;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@ -48,15 +48,6 @@ public class AntBuildWriter
this.localRepository = localRepository;
}
public void write()
throws IOException
{
writeBuildXml();
System.out.println(
"Wrote Ant project for " + project.getArtifactId() + " to " + project.getBasedir().getAbsolutePath() );
}
// ----------------------------------------------------------------------
// build.xml
// ----------------------------------------------------------------------
@ -95,7 +86,7 @@ public class AntBuildWriter
writer.endElement(); // project
close( w );
IOUtil.close( w );
}
private void writeCompileTestsTarget( XMLWriter writer, List testCompileSourceRoots )
@ -490,24 +481,6 @@ public class AntBuildWriter
*/
}
private void close( Writer closeable )
{
if ( closeable == null )
{
return;
}
try
{
closeable.close();
}
catch ( Exception e )
{
// ignore
// TODO: warn
}
}
// TODO: move to plexus-utils or use something appropriate from there (eclipse plugin too)
private static String toRelative( File basedir, String absolutePath )
{

View File

@ -61,11 +61,14 @@ public class AntMojo
try
{
antBuildWriter.write();
antBuildWriter.writeBuildXml();
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error building Ant script", e );
}
getLog().info(
"Wrote Ant project for " + project.getArtifactId() + " to " + project.getBasedir().getAbsolutePath() );
}
}