apache / apache/maven-assembly-plugin

[MASSEMBLY-450] manifestEntries ignored when manfestFile is specified

Open
#616 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
110
Forks
75
Avg merge
12h 54m
Merged PRs (30d)
10

Description

**[Robert Cauble](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rcauble)** opened **[MASSEMBLY-450](https://issues.apache.org/jira/browse/MASSEMBLY-450?redirect=false)** 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:

```java
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)

```java
manifest = mavenArchiver.getManifest( project, archiveConfiguration );
```

---

**Affects:** 2.2-beta-4

**Attachments:**
- [example.zip](https://issues.apache.org/jira/secure/attachment/12714267/example.zip) (_1.45 kB_)

**Issue Links:**
- [MASSEMBLY-657](https://issues.apache.org/jira/browse/MASSEMBLY-657) "jar" assembly format produces unexpected MANIFEST files and ignores "index" attribute with different archive settings

- [MSHARED-318](https://issues.apache.org/jira/browse/MSHARED-318) Merging of MANIFEST.MF does not work

- [MSHARED-318](https://issues.apache.org/jira/browse/MSHARED-318) Merging of MANIFEST.MF does not work
(_**"depends upon"**_)

4 votes, 5 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading ManifestConfigurationFinalizer and reproducing the behavior with the attached example.zip, then run mvn package and inspect the generated META-INF/MANIFEST.MF. Done means manifestEntries are merged and take effect even when manifestFile is specified, producing the expected Bundle-Version value.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.