[MNG-1598] Allow user to not include META-INF/maven in jars

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@345380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-11-18 00:18:20 +00:00
parent f936cfd675
commit bee6e222ee
2 changed files with 62 additions and 47 deletions

View File

@ -35,6 +35,8 @@ public class MavenArchiveConfiguration
private boolean index; private boolean index;
private boolean addMavenDescriptor = true;
private File manifestFile; private File manifestFile;
private ManifestConfiguration manifest; private ManifestConfiguration manifest;
@ -53,6 +55,11 @@ public class MavenArchiveConfiguration
return index; return index;
} }
public boolean isAddMavenDescriptor()
{
return addMavenDescriptor;
}
public File getManifestFile() public File getManifestFile()
{ {
return manifestFile; return manifestFile;
@ -77,6 +84,11 @@ public class MavenArchiveConfiguration
this.index = index; this.index = index;
} }
public void setAddMavenDescriptor( boolean addMavenDescriptor )
{
this.addMavenDescriptor = addMavenDescriptor;
}
public void setManifestFile( File manifestFile ) public void setManifestFile( File manifestFile )
{ {
this.manifestFile = manifestFile; this.manifestFile = manifestFile;

View File

@ -215,6 +215,8 @@ public class MavenArchiver
public void createArchive( MavenProject project, MavenArchiveConfiguration archiveConfiguration ) public void createArchive( MavenProject project, MavenArchiveConfiguration archiveConfiguration )
throws ArchiverException, ManifestException, IOException, DependencyResolutionRequiredException throws ArchiverException, ManifestException, IOException, DependencyResolutionRequiredException
{
if ( archiveConfiguration.isAddMavenDescriptor() )
{ {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// We want to add the metadata for the project to the JAR in two forms: // We want to add the metadata for the project to the JAR in two forms:
@ -265,6 +267,7 @@ public class MavenArchiver
os.close(); // stream is flushed but not closed by Properties.store() os.close(); // stream is flushed but not closed by Properties.store()
archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" ); archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" );
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Create the manifest // Create the manifest