Details
Description
Obviously, it is impossible to "merge" manifests from source WARs.
However, there is no possibility to specify own, even minimal, manifest for merged WAR file.
I suggest to add this option to plugin configuration.
For example,
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<descriptor>src/assemble/merge.xml</descriptor>
<manifestEntries>
<Implementation-Version>${majorVersion}</Implementation-Version>
<Implementation-Vendor>MyCompany</Implementation-Vendor>
</manifestEntries>
</configuration>
</plugin>
From the code point of view:
1) JarUtils.createJarFromDirectory():
- use Manifest as additional parameter, map two-argument call to new function
- when not null, pass Manifest as second argument to the constructor of JarOutputStream
2) UberWarMojo/WarArchiveMerger/MergedWarArchive trio: - use configuration values to create correct Manifest object
- send Manifest to JarUtil in MergedWarArchive.store()
I think it would also be a useful option to allow generation of manifest using logic inherited from Maven archiver - the logic which can e.g. add classpath to the manifest:
http://maven.apache.org/shared/maven-archiver/examples/classpath.html
In the case of uberwar, the classpath should consist of all transitive dependencies of merged war artifacts (not including the merged wars themselves, obviously).
Note that this functionality is especially important considering the Java EE 5 specification which strongly suggests that all packaged JARs and WARs in an EAR have their dependencies listed in MANIFEST.MF's Class-Path - for example, see the specification, section EE.8.2.6 on page 158.