Maven JAR Plugin
  1. Maven JAR Plugin
  2. MJAR-39

Maven Sets Manifest Attribute Values to Multi-Line Strings

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven version: 2.0.4
      Microsoft Windows XP [Version 5.1.2600]
    • Testcase included:
      yes
    • Number of attachments :
      3

      Description

      Maven will set a Manifest attribute's value to a multi-line string, which results in an invalid Manifest.
      By default, on its own, Maven adds a Specification-Title attribute to the Manifest, and sets its value to the POM's <description> element. If this is a multi-line value in the POM, Maven will insert it unchanged: and yield an invalid Manifest. Maven then can't even load the jar that it just created itself!
      I have filed another bug relating to the fact that it should not insert such an attribute by default: MJAR-38

        Issue Links

          Activity

          Hide
          Jerome Lacoste added a comment -

          > To do that, the lines after the first must be preceeded with a single space –
          > not any whitespace, but only a single space character. –

          The spec says:

          value: SPACE *otherchar newline *continuation
          continuation: SPACE *otherchar newline
          otherchar: any UTF-8 character except NUL, CR and LF

          otherchar doesn't exclude SPACE and I believe space is a valid UTF-8 character.

          So according to my understanding, a continuation might start with more than one space.

          What is invalid is an empty line in the wrong place. The fact that every continuation line starts with a space guarantees that a continuation line won't be mistaken into an "fully blank line".

          Now it is true that in maven 2.0.4 (which uses plexus-archiver 1.0-alpha-3) there's an issue. Continuations were wrongly identified and the example <description> you posted would result in a broken Manifest.

          So I would like to see whether the problems still appears if you force the use of a later plexus-archiver (at least version 1.0-alpha-6). I haven't had time to look into your latest test case.

          Show
          Jerome Lacoste added a comment - > To do that, the lines after the first must be preceeded with a single space – > not any whitespace, but only a single space character. – The spec says: value: SPACE *otherchar newline *continuation continuation: SPACE *otherchar newline otherchar: any UTF-8 character except NUL, CR and LF otherchar doesn't exclude SPACE and I believe space is a valid UTF-8 character. So according to my understanding, a continuation might start with more than one space. What is invalid is an empty line in the wrong place. The fact that every continuation line starts with a space guarantees that a continuation line won't be mistaken into an "fully blank line". Now it is true that in maven 2.0.4 (which uses plexus-archiver 1.0-alpha-3) there's an issue. Continuations were wrongly identified and the example <description> you posted would result in a broken Manifest. So I would like to see whether the problems still appears if you force the use of a later plexus-archiver (at least version 1.0-alpha-6). I haven't had time to look into your latest test case.
          Hide
          Jochen Wiedmann added a comment -

          Steve, I can confirm that I can reproduce the problem with maven 2.0.4 and your second zip file.

          I have checked, and maven 2.0.4 is indeed using plexus-archiver-1.0-alpha-3, which does add carriage returns and line feeds to the manifest value, thus producing invalid manifest entries. The plexus-archiver doesn't, as of 1.0-alpha-4.

          I have also verified, that version 2.1-SNAPSHOT of the maven-jar-plugin uses version 2.0.1 of the maven-archiver, which in turn uses plexus-archiver-1.0-alpha-4. In other words, the problem can be fixed by adding

          <version>2.1-SNAPSHOT</version>

          to the maven-jar-plugins configuration. (Which I have verified successfully.)

          I recommend, that this issue be closed, which I cannot do.

          Show
          Jochen Wiedmann added a comment - Steve, I can confirm that I can reproduce the problem with maven 2.0.4 and your second zip file. I have checked, and maven 2.0.4 is indeed using plexus-archiver-1.0-alpha-3, which does add carriage returns and line feeds to the manifest value, thus producing invalid manifest entries. The plexus-archiver doesn't, as of 1.0-alpha-4. I have also verified, that version 2.1-SNAPSHOT of the maven-jar-plugin uses version 2.0.1 of the maven-archiver, which in turn uses plexus-archiver-1.0-alpha-4. In other words, the problem can be fixed by adding <version>2.1-SNAPSHOT</version> to the maven-jar-plugins configuration. (Which I have verified successfully.) I recommend, that this issue be closed, which I cannot do.
          Hide
          Mike Perham added a comment -

          Issue is verified fixed in 2.1. Thanks Jochen.

          Show
          Mike Perham added a comment - Issue is verified fixed in 2.1. Thanks Jochen.
          Hide
          Brett Porter added a comment -

          though this is applied, when I set the jar plugin to use the archiver it still generates the elements

          Show
          Brett Porter added a comment - though this is applied, when I set the jar plugin to use the archiver it still generates the elements
          Hide
          Brett Porter added a comment -

          actually, won't fixing as MJAR-38 will remove it by default

          Show
          Brett Porter added a comment - actually, won't fixing as MJAR-38 will remove it by default

            People

            • Assignee:
              Mike Perham
              Reporter:
              Steven Coco
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: