Maven 1.x Jar Plugin
  1. Maven 1.x Jar Plugin
  2. MPJAR-36

Jar plugin generate incorrect manifest file

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.8
    • Labels:
      None
    • Number of attachments :
      3

      Description

      Current jar plugin genrate an invalid manifest file. In particular it is impossible to retrieve package version information for jars created by this plugin. See more details at http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#JAR%20Manifest

      Here is the example of current generated manifest file:

      ----------
      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.5.3
      Created-By: Apache Maven
      Built-By: Administrator
      Package: org.codehaus.activemq.jms.cci
      Build-Jdk: 1.4.2_02
      Class-Path: commons-logging-1.0.3.jar log4j-1.2.8.jar
      Extension-Name: ra-jms
      Specification-Title:
      Specification-Vendor:
      Implementation-Title: org.codehaus.activemq.jms.cci
      Implementation-Vendor:
      Implementation-Version: 0.0.2

      ----------

      And this is about how it should look like instead:

      ------------
      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.5.3
      Created-By: 1.4.2_02-b03 (Sun Microsystems Inc.)
      Class-path: commons-logging-1.0.3.jar log4j-1.2.8.jar

      Name: org/codehaus/some/component/
      Specification-Title: something
      Specification-Vendor:
      Specification-Version: 0.0.2
      Implementation-Title: org.codehaus.activemq.jms.cci
      Implementation-Vendor:
      Implementation-Version: 0.0.2

      --------------------------

        Issue Links

          Activity

          Hide
          Jörg Schaible added a comment -

          Link directly to the Maven issue

          Show
          Jörg Schaible added a comment - Link directly to the Maven issue
          Hide
          Michael Gaffney added a comment -

          I've attached a patch to fix this problem. I moved version information about a package from the 'main' manifest section to a package section. I looked at manifest files for other projects (like ant and xalan) and noticed they were also doing it this way. An added benefit is that it would now be possible to correctly merge two jar files and their manifest files.

          I deleted the setting of the 'Created-By' attribute because the ant manifest task correctly sets this with the java version used to generate the manifest file (which is what the Sun spec says it should be). This info was previously captured in the non-standard 'Build-Jdk' attribute which I removed because it was redundant.

          Show
          Michael Gaffney added a comment - I've attached a patch to fix this problem. I moved version information about a package from the 'main' manifest section to a package section. I looked at manifest files for other projects (like ant and xalan) and noticed they were also doing it this way. An added benefit is that it would now be possible to correctly merge two jar files and their manifest files. I deleted the setting of the 'Created-By' attribute because the ant manifest task correctly sets this with the java version used to generate the manifest file (which is what the Sun spec says it should be). This info was previously captured in the non-standard 'Build-Jdk' attribute which I removed because it was redundant.
          Hide
          Lukas Theussl added a comment -

          Patch applied with some modifications. Thanks!

          Show
          Lukas Theussl added a comment - Patch applied with some modifications. Thanks!
          Hide
          wolfgang haefelinger added a comment -

          It appears, that there is now no way in Maven 1.1 to add a entry to the Main section. This does not make sense. Of course, Maven should create a "correct" Manifest file. However, why having an opinion about explicitly adding something to the Main section? This patch needs to be improved to allow for attributes in the Main section as well.

          Show
          wolfgang haefelinger added a comment - It appears, that there is now no way in Maven 1.1 to add a entry to the Main section. This does not make sense. Of course, Maven should create a "correct" Manifest file. However, why having an opinion about explicitly adding something to the Main section? This patch needs to be improved to allow for attributes in the Main section as well.
          Hide
          Lukas Theussl added a comment -

          For non-standard attributes you should use a custom manifest file with the maven.jar.manifest property.

          Show
          Lukas Theussl added a comment - For non-standard attributes you should use a custom manifest file with the maven.jar.manifest property.

            People

            • Assignee:
              Lukas Theussl
              Reporter:
              Eugene Kuleshov
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: