Now allowing custom manifest file to be set in the generated EAR file.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@234462 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephane Nicoll 2005-08-22 10:08:55 +00:00
parent a20c98aa76
commit 30804e163a
1 changed files with 18 additions and 2 deletions

View File

@ -50,7 +50,6 @@ public class EarMojo
* The location of the manifest file to be used within the ear file.
*
* @parameter expression="${basedir}/src/main/application/META-INF/MANIFEST.MF"
* @TODO handle this field
*/
private String manifestLocation;
@ -113,7 +112,7 @@ public class EarMojo
if ( !sourceFile.isFile() )
{
throw new MojoExecutionException( "Cannot copy a directory: " + sourceFile.getAbsolutePath() +
throw new MojoExecutionException( "Cannot copy a directory: " + sourceFile.getAbsolutePath() +
"; Did you package/install " + module.getArtifact().getId() + "?" );
}
@ -154,6 +153,9 @@ public class EarMojo
MavenArchiver archiver = new MavenArchiver();
archiver.setOutputFile( earFile );
// Include custom manifest if necessary
includeCustomManifestFile();
archiver.getArchiver().addDirectory( getBuildDir() );
archiver.createArchive( getProject(), archive );
@ -169,4 +171,18 @@ public class EarMojo
{
return new File( buildDir, uri );
}
private void includeCustomManifestFile()
{
File customManifestFile = new File( manifestLocation );
if ( !customManifestFile.exists() )
{
// Does not exist so will use default
}
else
{
getLog().info( "Including custom manifest file[" + customManifestFile + "]" );
archive.setManifestFile( customManifestFile );
}
}
}