diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-19 22:00:09 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-19 22:00:09 +0700 |
commit | 0b182d606732d77ece079e20de6458c33a8413a3 (patch) | |
tree | cc23d95541f941b7eaf849c4824884419d79c893 /aspectjweaver | |
parent | f0cc6138f97014bd578c8edc6cb052409abb66a5 (diff) | |
download | aspectj-0b182d606732d77ece079e20de6458c33a8413a3.tar.gz aspectj-0b182d606732d77ece079e20de6458c33a8413a3.zip |
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>
Diffstat (limited to 'aspectjweaver')
-rw-r--r-- | aspectjweaver/pom.xml | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index 72c223ad6..daae4574e 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -102,9 +102,20 @@ <Bundle-Name>AspectJ Weaver</Bundle-Name> <Bundle-Version>${project.version}</Bundle-Version> - <Bundle-Copyright>(C) Copyright 1999-2001 Xerox Corporation, - 2002 Palo Alto Research Center, Incorporated (PARC), - 2003-2019 Contributors. All Rights Reserved</Bundle-Copyright> + <!-- + 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 -> deactivate + --> + <Bundle-Copyright>(C) Copyright 1999-2001 Xerox Corporation, 2002 Palo Alto Research Center, Incorporated (PARC), 2003-2020 Contributors. All Rights Reserved</Bundle-Copyright> </manifestEntries> </manifestSection> </manifestSections> |