PR: MNG-1650

Submitted By: Allan Ramirez
Reviewed By: John Casey

Applied patch, with modifications. First, refactored to avoid the use of a member variable for turning POM inclusion on/off. Second, please remember to follow the code formatting rules for Maven, available on the project website.

This patch provides a new method for createArchive(..) which includes a flag for turning off POM inclusion from the resulting archive. The default mode used by the original createArchive(..) method is still to include POM information.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@351476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-12-01 21:32:42 +00:00
parent 3230df32bf
commit b0b047eff9
1 changed files with 18 additions and 4 deletions

View File

@ -45,7 +45,7 @@ public class MavenArchiver
private JarArchiver archiver;
private File archiveFile;
/**
* Return a pre-configured manifest
*
@ -215,6 +215,13 @@ public class MavenArchiver
public void createArchive( MavenProject project, MavenArchiveConfiguration archiveConfiguration )
throws ArchiverException, ManifestException, IOException, DependencyResolutionRequiredException
{
createArchive( project, archiveConfiguration, false );
}
public void createArchive( MavenProject project, MavenArchiveConfiguration archiveConfiguration,
boolean excludePomFiles )
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...
@ -246,8 +253,12 @@ public class MavenArchiver
File exportReadyPom = writeExportReadyPom( workingProject );
archiver.addFile( exportReadyPom, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.xml" );
if( !excludePomFiles )
{
archiver.addFile( exportReadyPom, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.xml" );
}
// ----------------------------------------------------------------------
// Create pom.properties file
// ----------------------------------------------------------------------
@ -266,7 +277,10 @@ public class MavenArchiver
os.close(); // stream is flushed but not closed by Properties.store()
archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" );
if( !excludePomFiles )
{
archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" );
}
}
// ----------------------------------------------------------------------