Error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project MyProject: Error assembling JAR: Unable to read manifest file (line too long) -> [Help 1]
The official documentation had the following note:
Line length:
No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).
No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).
In my case, the line length was definitely over 72 bytes, so I proceeded to split each of the jar file dependencies out into its own line. My initial cut of the change had each new jar starting on a new line with a single space character at the beginning of the line. Unfortunately that produced garbage results - it appears that the single space character at the start of a line is a line continuation marker and is stripped when the full line is put together. This results in something like "dep-jar-1.jardep-jar-2.jardep-jar-3.jar..." being created.
Since we want each jar to be separate, a double space is required at the beginning of each line! This looks like the following...
MANIFEST.MF
Manifest-Version: 1.0
Main-Class: net.igorkromin.MainClass
Class-Path: dep-jar-1.jar
dep-jar-2.jar
dep-jar-3.jar
dep-jar-4.jar
dep-jar-5.jar
dep-jar-6.jar
dep-jar-7.jar
dep-jar-8.jar
dep-jar-9.jar
With double spaces in place, everything worked as expected!
-i