You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Sauer, Joachim" <jo...@dynatrace.com> on 2018/07/09 08:10:17 UTC

assembly:single with jar-with-dependencies breaks with multi-release jars

Hello Maven Users!


I've come across and filed a bug (https://issues.apache.org/jira/browse/MASSEMBLY-891) where the assembly plugin fails with multi-release jars such as log4j-api-2.9.1.jar.


Multi-release jars are relatively new, so it's no surprise that there's not active support for it yet, but it seems that instead of just "ignoring" them, the assembly plugin actively breaks them.


In our specific case one class (org.apache.logging.log4j.util.StackLocator) exists twice in log4j-api-2.9.1.jar. Once in the usual place and once under META-INF/versions/9. The later one is supposed to be loaded only in Java 9 and upwards and as such is compiled with a class file version 53.0.


I expected the assembly plugin to either ignore the second version or just straight copy it as it would with any other file under META-INF, but instead the output jar contained the version from META-INF/versions/9 under both the regular path and under META-INF/versions/9, thus making the output jar incompatible with Java 8 or lower.


Has anyone else run into this? Does anyone know of a workaround for this problem?


regards

Joachim Sauer

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. Dynatrace Austria GmbH (registration number FN 91482h) is a company registered in Linz whose registered office is at 4040 Linz, Austria, Freistädterstraße 313

AW: assembly:single with jar-with-dependencies breaks with multi-release jars

Posted by "Sauer, Joachim" <jo...@dynatrace.com>.
Hello,


I've since been able to reduce the problem further: It only occurs when the build is running under a Java 10 machine (possibly Java 9 as well, didn't test that). I didn't expect the JDK used to run Maven to have such an impact on this.


Has anyone else run into this? Could anyone reproduce this?


cheers

Joachim

________________________________
Von: Sauer, Joachim
Gesendet: Montag, 9. Juli 2018 10:10:17
An: users@maven.apache.org
Betreff: assembly:single with jar-with-dependencies breaks with multi-release jars


Hello Maven Users!


I've come across and filed a bug (https://issues.apache.org/jira/browse/MASSEMBLY-891) where the assembly plugin fails with multi-release jars such as log4j-api-2.9.1.jar.


Multi-release jars are relatively new, so it's no surprise that there's not active support for it yet, but it seems that instead of just "ignoring" them, the assembly plugin actively breaks them.


In our specific case one class (org.apache.logging.log4j.util.StackLocator) exists twice in log4j-api-2.9.1.jar. Once in the usual place and once under META-INF/versions/9. The later one is supposed to be loaded only in Java 9 and upwards and as such is compiled with a class file version 53.0.


I expected the assembly plugin to either ignore the second version or just straight copy it as it would with any other file under META-INF, but instead the output jar contained the version from META-INF/versions/9 under both the regular path and under META-INF/versions/9, thus making the output jar incompatible with Java 8 or lower.


Has anyone else run into this? Does anyone know of a workaround for this problem?


regards

Joachim Sauer

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. Dynatrace Austria GmbH (registration number FN 91482h) is a company registered in Linz whose registered office is at 4040 Linz, Austria, Freist?dterstra?e 313