Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-99

Archiver should validate manifest attribute names.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • maven-archiver-2.5
    • maven-archiver
    • None

    Description

      I noticed that the jar plugin and maven archiver will allow you to use an invalid attribute name in your manifest. According the jar specification, attribute names can only contain letters, numbers, dash, or underscore [1]. Currently if you put an attribute name like "my.attribute" in the manifest configuration of the jar plugin, the attribute will be added to your jar manifest. If you then try to use this jar file in your classpath, for example as a dependency of another project, you will get a compilation error:

      [INFO] Compilation failure
      error: error reading /home/me/.m2/repository/org/company/my-project/1.0-SNAPSHOT/my-project-1.0-SNAPSHOT.jar; invalid header field name: my.attribute

      The archiver or the jar plugin should do a regex check to make sure that you are using a valid attribute name. And if not, a warning or error should be produced.

      [1] http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Name-Value%20pairs%20and%20Sections

      Attachments

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              pgier Paul Gier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: