jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Shared Components
  • MSHARED-134

Using ${artifcactId}-Extention-Name in MANIFEST file can create invalid MANIFEST files

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: maven-archiver-2.4
  • Fix Version/s: maven-archiver-2.5
  • Component/s: maven-archiver
  • Labels:
    None
  • Environment:
    Java HotSpot(TM) Client VM (build 1.5.0_13-121)

Description

If you have a maven dependency on an something with an artifactId that contains a '.' in it, it creates an illegal manifest file when trying to create an executable jar file (java -jar foo.jar).

Exception in thread "main" java.io.IOException: invalid header field name: geronimo-jms_1.1_spec-Extension-Name
        at java.util.jar.Attributes.read(Attributes.java:409)
        at java.util.jar.Manifest.read(Manifest.java:167)
        at java.util.jar.Manifest.<init>(Manifest.java:52)
        at java.util.jar.JarFile.getManifestFromReference(JarFile.java:158)
        at java.util.jar.JarFile.getManifest(JarFile.java:145)

Here's my configuration:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>my.class.Test</mainClass>
              <addClasspath>true</addClasspath>
              <addExtensions>true</addExtensions>
              <classpathPrefix>./lib/</classpathPrefix>
            </manifest>
          </archive>
        </configuration>
      </plugin>

I added the following dependency:

<dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jms_1.1_spec</artifactId>
    </dependency>

When the maven-archiver tries to create a manifest file with the JARs dependencies it adds the following to the META-INF/MANIFEST.MF file:

geronimo-jms_1.1_spec-Extension-Name: geronimo-jms_1.1_spec
geronimo-jms_1.1_spec-Implementation-Version: 1.0

After digging around a bit it turns out that '.' is an illegal character in the "Extension-Name" and "Implementaion-Version" header fields, which leads to the following exception when I try to run "java -jar Test.jar"

java.io.IOException: invalid header field name: geronimo-jms_1.1_spec-Extension-Name

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    MavenArchiver.java-Patch.txt
    11/Apr/08 12:20 PM
    2 kB
    Sridhar Komandur
  2. Text File
    nautilus-debug-log.txt
    11/Apr/08 12:48 AM
    188 kB
    Sridhar Komandur

Issue Links

relates to

Improvement - An improvement or enhancement to an existing feature or task. MSHARED-99 Archiver should validate manifest attribute names.

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Sridhar Komandur added a comment - 11/Apr/08 12:48 AM

Please find the attached patch file that fixes this issue by replacing '.' with '_' in the artifactId

Show
Sridhar Komandur added a comment - 11/Apr/08 12:48 AM Please find the attached patch file that fixes this issue by replacing '.' with '_' in the artifactId
Hide
Permalink
Sridhar Komandur added a comment - 11/Apr/08 12:20 PM

(for some reason my attachment from last night does not show, so 'attach'ing again)

Show
Sridhar Komandur added a comment - 11/Apr/08 12:20 PM (for some reason my attachment from last night does not show, so 'attach'ing again)
Hide
Permalink
Chris Beach added a comment - 19/Feb/09 10:23 AM

This issue is preventing my Maven-built project from running. I'm using Apache Axis2, which has transitive dependencies on Geronimo.

Show
Chris Beach added a comment - 19/Feb/09 10:23 AM This issue is preventing my Maven-built project from running. I'm using Apache Axis2, which has transitive dependencies on Geronimo.
Hide
Permalink
Kristian Rosenvold added a comment - 24/Jan/12 8:58 AM

Fixed with testcase in r1235286

Show
Kristian Rosenvold added a comment - 24/Jan/12 8:58 AM Fixed with testcase in r1235286

People

  • Assignee:
    Kristian Rosenvold
    Reporter:
    Todd Caine
Vote (6)
Watch (7)

Dates

  • Created:
    20/Mar/08 5:16 PM
    Updated:
    24/Jan/12 8:58 AM
    Resolved:
    24/Jan/12 8:58 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.