Maven Archiver putting in weird line breaks in classpath for manifest
Per the java spec the classpath line in the manifest.mf for a jar can only be a certain number of bytes. After that a line break is inserted and the new line begins with an empty space.
Using Maven 3, and maven-jar-plugin version 2.3.2 my manifest ends up with some interesting line breaks in the classpath and I think that may be breaking my EAR when deployed into WAS 7.
Just want to make sure the manifest is OK to look like that (may not match byte length but so you get the picture):
Class-Path: log4j-1.2.16.jar projectthatislong-0.0.1-SNAPSHOT.jar projectt
hatislong-0开发者_如何学Python.0.1-SNAPSHOT.jar
Notice how it breaks in the middle of the third project at the end of the first line? Seems like that would not be a good thing. Is there a way to correct this? I don't believe the "customClasspathLayout" option is going to work for me.
This is in line with the specification for Java manifest files. Note the line length is 72 characters, and if it exceeds that it is meant to wrap at that point.
I was struggling ~8 hours. Plexus archiver always repacks/restructures your MANIFEST file if even you specify custom one. Line breaks are always added (72 chars limitation) There is no way to change this behaviour plexus archiver code I found the following workaround. I started using truezip-maven-plugin to update generated ear:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<executions>
<execution>
<id>replace-broken-manifest</id>
<goals>
<goal>copy</goal>
</goals>
<phase>package</phase>
<configuration>
<files>
<file>
<source>src/main/resources/META-INF/MANIFEST.MF</source>
<outputDirectory>${project.build.directory}/${project.build.finalName}.${project.packaging}/META-INF</outputDirectory>
</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
精彩评论