[MASSEMBLY-450] manifestEntries ignored when manfestFile is specified
Robert Cauble opened MASSEMBLY-450 and commented
The maven jar plugin supports the behavior of manifestEntries overriding the manifestFile as indicated here:
http://maven.apache.org/guides/mini/guide-manifest.html
However, within the maven assembly plugin, if manifestFile is specified, manifestEntries is ignored.
Reproduction
> unzip example.zip
> cd example
> mvn package
> cd target
> unzip example-4.2-plugin.jar
> cat META-INF/MANFEST
Results:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 14.0-b16 (Sun Microsystems Inc.)
Bundle-ManifestVersion: 2
Bundle-Name: example
Bundle-SymbolicName: example; singleton:=true
Bundle-Version: 1.0
Expected:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 14.0-b16 (Sun Microsystems Inc.)
Bundle-ManifestVersion: 2
Bundle-Name: example
Bundle-SymbolicName: example; singleton:=true
Bundle-Version: 4.2
The problem appears to be in the class ManifestConfigurationFinalizer:
if ( manifestFile != null )
{
...
manifest = new Manifest( manifestFileReader );
...
}
else
{
manifest = mavenArchiver.getManifest( project, archiveConfiguration.getManifest() );
}
I believe the fix is to change to the following (this already handles merging the manifest file with the configured manifestEntries)
manifest = mavenArchiver.getManifest( project, archiveConfiguration );
Affects: 2.2-beta-4
Attachments:
- example.zip (1.45 kB)
Issue Links:
-
MASSEMBLY-657 "jar" assembly format produces unexpected MANIFEST files and ignores "index" attribute with different archive settings
-
MSHARED-318 Merging of MANIFEST.MF does not work
-
MSHARED-318 Merging of MANIFEST.MF does not work ("depends upon")
4 votes, 5 watchers