mirror of https://github.com/apache/maven.git
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:
parent
14db4338c1
commit
e8540568ae
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue