Author: snicoll Date: Mon Aug 22 03:08:55 2005 New Revision: 234462 URL: http://svn.apache.org/viewcvs?rev=234462&view=rev Log: Now allowing custom manifest file to be set in the generated EAR file.
Modified: maven/components/trunk/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java Modified: maven/components/trunk/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java?rev=234462&r1=234461&r2=234462&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java Mon Aug 22 03:08:55 2005 @@ -50,7 +50,6 @@ * 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 @@ 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 @@ MavenArchiver archiver = new MavenArchiver(); archiver.setOutputFile( earFile ); + // Include custom manifest if necessary + includeCustomManifestFile(); + archiver.getArchiver().addDirectory( getBuildDir() ); archiver.createArchive( getProject(), archive ); @@ -168,5 +170,19 @@ private static File buildDestinationFile( File buildDir, String uri ) { 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 ); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]