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 2.x JAR Plugin
  • MJAR-1

Manifest generation problems caused by valid POM information

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.1
  • Component/s: None
  • Labels:
    None

Description

It looks like we have some problems with the contents of manifests in jar files.

According to Sun's documentation (http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html), there are three basic formatting rules which are not always being enforced:
1) All text must be UTF-8
2) Lines are limited to 72 characters; longer lines must be continued
3) Sections are divided by blank lines

Where are these rules being violated? The first rule can be violated by any POM which is in a character set other than UTF-8. The last two rules can be violated by any POM value which spans multiple lines. Both of these are potential problems since a number of POM values go directly into the manifest without sufficient checking.

Example:
The plugin I have been working on suddenly stopped working. It stopped when I added a two-line description to the POM. I have been able to determine that converting the second line of the description into a proper manifest continuation line fixed the problem. As it turns out, the class loader was ignoring the jar; this created an error where the name of the Mojo class was found but the class could not be loaded.

Workarounds for the present:
– Any POM fields which end up in a jar manifest needs to be limited to UTF-8 characters.
– Multi-line values should be constructed so that all lines start with a space character (not strictly required for the first line but it doesn't hurt).

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

Attachments

  1. Text File
    MNG-1558-plexus-archiver.patch
    06/Dec/05 3:25 AM
    4 kB
    Edwin Punzalan

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Zeger Hendrikse added a comment - 24/Nov/05 10:25 AM

We (at Fortis bank) are seriously hampered by this issue as well.

  • Trying to let Maven add entries to the manifest by specifying <addMavenDescriptor>false</addMavenDescriptor> results in a null-pointer exception
  • Specifying <Specification-Title> ourselves in the jar plug-in configuration results in a multiple specification error
  • Concatenating the content of the description element in the POM to one line only, results in a Specification-Title entry in the manifest that is broken up at 72 chars (as it should by the spec), but which makes the WARs and JARS undeployable on the application server (WPS 5.1.0.1)

We concluded, it should either be possible to

  • Specify your own manifest file in the JAR plug-in (and not let Maven append the contents of your private manifest file to the one generated by Maven itself, as it seems to do currently)
  • Be able to switch on/off all separate attributes of the manifest generation
  • Don't put the contents of the description element in the POM in the Specification-Title entry in the manifest. If the length cannot be more than 72 chars, what would be the added value of the description in the POM?

Currently we see ourselves forced to abbreviate all the descriptions to 72-"Specification-Title".length() characters, but this doesn't result in a nice entry page in the Maven site generated pages )-:

Show
Zeger Hendrikse added a comment - 24/Nov/05 10:25 AM We (at Fortis bank) are seriously hampered by this issue as well.
  • Trying to let Maven add entries to the manifest by specifying <addMavenDescriptor>false</addMavenDescriptor> results in a null-pointer exception
  • Specifying <Specification-Title> ourselves in the jar plug-in configuration results in a multiple specification error
  • Concatenating the content of the description element in the POM to one line only, results in a Specification-Title entry in the manifest that is broken up at 72 chars (as it should by the spec), but which makes the WARs and JARS undeployable on the application server (WPS 5.1.0.1)
We concluded, it should either be possible to
  • Specify your own manifest file in the JAR plug-in (and not let Maven append the contents of your private manifest file to the one generated by Maven itself, as it seems to do currently)
  • Be able to switch on/off all separate attributes of the manifest generation
  • Don't put the contents of the description element in the POM in the Specification-Title entry in the manifest. If the length cannot be more than 72 chars, what would be the added value of the description in the POM?
Currently we see ourselves forced to abbreviate all the descriptions to 72-"Specification-Title".length() characters, but this doesn't result in a nice entry page in the Maven site generated pages )-:
Hide
Permalink
Michal Stochmialek added a comment - 25/Nov/05 10:53 AM

I also had some problems connected with this issue.

I had problems while running tests. Surefire was throwning NoClassDefFound for classes in jar created by maven. After longer investigation I've discovered that Specification-Title of the jar was filled with description field's content. After removing the description field and rebuilding the jar, the problem dissapeared.

I've voted on this bug.

best regards

Show
Michal Stochmialek added a comment - 25/Nov/05 10:53 AM I also had some problems connected with this issue. I had problems while running tests. Surefire was throwning NoClassDefFound for classes in jar created by maven. After longer investigation I've discovered that Specification-Title of the jar was filled with description field's content. After removing the description field and rebuilding the jar, the problem dissapeared. I've voted on this bug. best regards
Hide
Permalink
Lilians Auvigne added a comment - 02/Dec/05 8:12 AM

I have the same problem with description.length < 72 and multi lines description

<description>Test multi
lines</description>

maven-archiver generate invalid Manifest

Extension-Name: module
Specification-Title: Test multi
lines
Specification-Vendor...

Show
Lilians Auvigne added a comment - 02/Dec/05 8:12 AM I have the same problem with description.length < 72 and multi lines description <description>Test multi lines</description> maven-archiver generate invalid Manifest Extension-Name: module Specification-Title: Test multi lines Specification-Vendor...
Hide
Permalink
Edwin Punzalan added a comment - 06/Dec/05 3:22 AM

Attached patch with updated test cases for the problem.

Show
Edwin Punzalan added a comment - 06/Dec/05 3:22 AM Attached patch with updated test cases for the problem.
Hide
Permalink
Edwin Punzalan added a comment - 06/Dec/05 3:25 AM

Sorry about that the multiple attach/delete... was cleaning the unit test output.

Show
Edwin Punzalan added a comment - 06/Dec/05 3:25 AM Sorry about that the multiple attach/delete... was cleaning the unit test output.
Hide
Permalink
John Casey added a comment - 08/Dec/05 8:44 PM

Applied the patch, and added code to force output to UTF-8 encoding.

Show
John Casey added a comment - 08/Dec/05 8:44 PM Applied the patch, and added code to force output to UTF-8 encoding.

People

  • Assignee:
    John Casey
    Reporter:
    Bob Allison
Vote (2)
Watch (1)

Dates

  • Created:
    14/Nov/05 1:20 PM
    Updated:
    21/Feb/07 1:05 PM
    Resolved:
    08/Dec/05 8:44 PM
  • 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.