o use FileUtils for copying the POM.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@512749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-02-28 13:17:02 +00:00
parent 0f95fb4472
commit f37ff7ef4d
2 changed files with 4 additions and 28 deletions

View File

@ -27,7 +27,7 @@
<artifactId>maven-embedder</artifactId>
<name>Maven Embedder</name>
<properties>
<bundleVersion>2.1.0.v20070224-1541</bundleVersion>
<bundleVersion>2.1.0.v20070227-2207</bundleVersion>
</properties>
<build>
<resources>

View File

@ -21,16 +21,10 @@ import org.apache.maven.artifact.metadata.AbstractArtifactMetadata;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
/**
* Attach a POM to an artifact.
@ -84,34 +78,16 @@ public class ProjectArtifactMetadata
// here and be safe. jvz.
// ----------------------------------------------------------------------------
Reader reader = null;
Writer writer = null;
try
{
reader = new FileReader( file );
writer = new FileWriter( destination );
IOUtil.copy( reader, writer );
}
catch ( FileNotFoundException e )
{
throw new RepositoryMetadataStoreException( "Error rewriting POM", e );
FileUtils.copyFile( file, destination );
}
catch ( IOException e )
{
throw new RepositoryMetadataStoreException( "Error rewriting POM", e );
}
finally
{
IOUtil.close( reader );
IOUtil.close( writer );
throw new RepositoryMetadataStoreException( "Error copying POM to the local repository.", e );
}
}
public String toString()
{
return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();