From 2da90eece1f0c32e98db424d3990f9445a48ba0a Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Fri, 18 Nov 2005 07:54:40 +0000 Subject: [PATCH] Fix compile error git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@345471 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/archiver/MavenArchiver.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java index 783b78cbb1..6f3d6e84ac 100644 --- a/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java +++ b/maven-archiver/src/main/java/org/apache/maven/archiver/MavenArchiver.java @@ -216,6 +216,12 @@ public class MavenArchiver public void createArchive( MavenProject project, MavenArchiveConfiguration archiveConfiguration ) throws ArchiverException, ManifestException, IOException, DependencyResolutionRequiredException { + // we have to clone the project instance so we can write out the pom with the deployment version, + // without impacting the main project instance... + MavenProject workingProject = new MavenProject( project ); + + File pomPropertiesFile = new File( workingProject.getFile().getParentFile(), "pom.properties" ); + if ( archiveConfiguration.isAddMavenDescriptor() ) { // ---------------------------------------------------------------------- @@ -229,10 +235,6 @@ public class MavenArchiver // POM information without the use of maven tools can do so. // ---------------------------------------------------------------------- - // we have to clone the project instance so we can write out the pom with the deployment version, - // without impacting the main project instance... - MavenProject workingProject = new MavenProject( project ); - if ( workingProject.getArtifact().isSnapshot() ) { workingProject.setVersion( workingProject.getArtifact().getVersion() ); @@ -258,8 +260,6 @@ public class MavenArchiver p.setProperty( "version", workingProject.getVersion() ); - File pomPropertiesFile = new File( workingProject.getFile().getParentFile(), "pom.properties" ); - OutputStream os = new FileOutputStream( pomPropertiesFile ); p.store( os, "Generated by Maven" ); @@ -335,8 +335,10 @@ public class MavenArchiver archiver.createArchive(); // Cleanup - - pomPropertiesFile.delete(); + if ( archiveConfiguration.isAddMavenDescriptor() ) + { + pomPropertiesFile.delete(); + } } private File writeExportReadyPom( MavenProject project )