[ http://jira.codehaus.org/browse/MSHARED-134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Herve Boutemy updated MSHARED-134: ---------------------------------- 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). {noformat} 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) {noformat} Here's my configuration: {code:xml} <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> {code} I added the following dependency: {code:xml} <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jms_1.1_spec</artifactId> </dependency> {code} 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: {noformat} geronimo-jms_1.1_spec-Extension-Name: geronimo-jms_1.1_spec geronimo-jms_1.1_spec-Implementation-Version: 1.0 {noformat} 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 was: 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 > Using ${artifcactId}-Extention-Name in MANIFEST file can create invalid > MANIFEST files > -------------------------------------------------------------------------------------- > > Key: MSHARED-134 > URL: http://jira.codehaus.org/browse/MSHARED-134 > Project: Maven Shared Components > Issue Type: Bug > Affects Versions: maven-archiver-2.4 > Environment: Java HotSpot(TM) Client VM (build 1.5.0_13-121) > Reporter: Todd Caine > Attachments: MavenArchiver.java-Patch.txt, nautilus-debug-log.txt > > > 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). > {noformat} > 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) > {noformat} > Here's my configuration: > {code:xml} > <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> > {code} > I added the following dependency: > {code:xml} > <dependency> > <groupId>org.apache.geronimo.specs</groupId> > <artifactId>geronimo-jms_1.1_spec</artifactId> > </dependency> > {code} > 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: > {noformat} > geronimo-jms_1.1_spec-Extension-Name: geronimo-jms_1.1_spec > geronimo-jms_1.1_spec-Implementation-Version: 1.0 > {noformat} > 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira