Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
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
- is related to
-
MSHARED-134 Using ${artifcactId}-Extention-Name in MANIFEST file can create invalid MANIFEST files
- Closed