Fix invalid manifests leading to "Could not find or load main class"
WARNING: Please avoid line breaks in manifest values! They are passed on
like this: Assembly Plugin -> Plexus Archiver -> JRE java.util.jar
.Manifest.write(OutputStream).
The JRE Manifest class inserts hard line breaks always after 72
characters, no matter if those 72 characters contain line feeds, tabs or
spaces. Hence, it can happen that unwanted blank lines end up in the
middle of a manifest section, making the manifest invalid. Calls like
e.g. 'java -cp aspectjtools.jar org.aspectj.tools.ajc.Main' can then
fail with the absolutely unexpected error 'Could not find or load main
class org.aspectj.tools.ajc.Main'.
In IntelliJ IDEA you can deactivate wrapping text inside XML tags like
this: "File | Settings | Editor | Code Style | XML | Wrap text -> off"
The problem occurs in Maven Assembly in versions higher than 2.2. More
exactly, it occurs in Plexus Archiver after in more recent versions it
switched to using the JRE Manifest class.
TODO 1: Either add a test step in phase 'verify' doing something like
this:
new Manifest(new FileInputStream("MANIFEST.MF"));
This would lead to "IOException: invalid header field (line xy)" in case
of an invalid manifest file.
TODO 2: Or file a JRE bug at Oracle or OpenJDK, wherever appropriate.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>