Maven Assembly Plugin
  1. Maven Assembly Plugin
  2. MASSEMBLY-450

manifestEntries ignored when manfestFile is specified

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2-beta-4
    • Fix Version/s: None
    • Component/s: manifest
    • Labels:
      None

      Description

      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 );
      

        Issue Links

          Activity

          Robert Cauble created issue -
          Dennis Lundberg made changes -
          Field Original Value New Value
          Component/s manifest [ 15762 ]
          Description 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 );

          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
          ============
          {noformat}
          > unzip example.zip
          > cd example
          > mvn package
          > cd target
          > unzip example-4.2-plugin.jar
          > cat META-INF/MANFEST
          {noformat}

          Results:
          {noformat}
          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
          {noformat}

          Expected:
          {noformat}
          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
          {noformat}

          The problem appears to be in the class ManifestConfigurationFinalizer:
          {code:java}
          if ( manifestFile != null )
          {
             ...
             manifest = new Manifest( manifestFileReader );
             ...
          }
          else
          {
             manifest = mavenArchiver.getManifest( project, archiveConfiguration.getManifest() );
          }
          {code}

          I believe the fix is to change to the following (this already handles merging the manifest file with the configured manifestEntries)
          {code:java}
          manifest = mavenArchiver.getManifest( project, archiveConfiguration );
          {code}
          Oleksii Batiuk made changes -
          Link This issue relates to MASSEMBLY-657 [ MASSEMBLY-657 ]
          Karl Heinz Marbaise made changes -
          Link This issue is related to MSHARED-318 [ MSHARED-318 ]
          Karl Heinz Marbaise made changes -
          Link This issue depends upon MSHARED-318 [ MSHARED-318 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 09:09:00 UTC 2015 [ 1428224940639 ]
          Mark Thomas made changes -
          Link This issue depends upon MSHARED-318 [ MSHARED-318 ]
          Mark Thomas made changes -
          Link This issue is related to MSHARED-318 [ MSHARED-318 ]
          Mark Thomas made changes -
          Workflow jira [ 12717397 ] Default workflow, editable Closed status [ 12760204 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 22:33:31 UTC 2015 [ 1428273211083 ]
          Mark Thomas made changes -
          Link This issue is related to MSHARED-318 [ MSHARED-318 ]
          Mark Thomas made changes -
          Link This issue depends upon MSHARED-318 [ MSHARED-318 ]
          Mark Thomas made changes -
          Workflow jira [ 12955129 ] Default workflow, editable Closed status [ 12992304 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Robert Cauble
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Development