[
https://issues.apache.org/jira/browse/MASSEMBLY-891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16561632#comment-16561632
]
G G commented on MASSEMBLY-891:
-------------------------------
$ unzip -l
~/.m2/repository/org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar |
grep StackLocator.class
6336 09-17-2017 22:52 org/apache/logging/log4j/util/StackLocator.class
7264 09-17-2017 22:52
META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class
$ JAVA_HOME=/path/to/jdk-10 mvn package
$ unzip -l target/reproducer-0.0.1-SNAPSHOT-jar-with-dependencies.jar | grep
StackLocator.class
7264 09-17-2017 22:52 org/apache/logging/log4j/util/StackLocator.class
7264 09-17-2017 22:52
META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class
# Now with Java 8:
$ rm target/reproducer-0.0.1-SNAPSHOT-jar-with-dependencies.jar
$ JAVA_HOME=/path/to/jdk8 mvn package
$ unzip -l target/reproducer-0.0.1-SNAPSHOT-jar-with-dependencies.jar | grep
StackLocator.class
6336 09-17-2017 22:52 org/apache/logging/log4j/util/StackLocator.class
7264 09-17-2017 22:52
META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class
> Multi-release JAR files aren't handled correctly
> ------------------------------------------------
>
> Key: MASSEMBLY-891
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-891
> Project: Maven Assembly Plugin
> Issue Type: Bug
> Affects Versions: 3.1.0
> Reporter: Joachim Sauer
> Priority: Major
> Attachments: reproducer.zip
>
>
> Apparently there's now a thing called a multi-release JAR where a JAR file
> can contain multiple copies of the same class, where some are used only on
> certain Java versions and up (starting with Java 9):
> [http://openjdk.java.net/jeps/238]
>
> Sounds like a neat idea. For backwards compatibility all the "old" class
> files are where they always used to be and new ones are placed under
> META-INF/versions/<javaVersion>/
> log4j-api-2.9.1.jar is such a multi-release jar and works just fine.
>
> However, when building a jar-with-dependencies it seems that the "regular"
> class file gets overwritten with the Java 9 version of the class file for
> some reason.
> Looking at log4j-api-2.9.1:
> {{$ unzip -l log4j-api-2.9.1.jar | grep StackLocator.class}}
> {{ 6336 2017-09-17 22:52
> org/apache/logging/log4j/util/StackLocator.class}}
> {{ 7264 2017-09-17 22:52
> META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class}}
> Looking at the jar-with-dependencies produces by maven-assembly-plugin 3.1.0:
> {{unzip -l target/myproject-0.0.1-SNAPSHOT-jar-with-dependencies.jar | grep
> StackLocator.class}}
> {{ 7264 2017-09-17 22:52
> org/apache/logging/log4j/util/StackLocator.class}}
> {{ 7264 2017-09-17 22:52
> META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class}}
> Now obviously the best fix would be to make maven-assembly-plugin fully
> Multi-release compatible and even write the correct META-INF/MANIFEST.MF
> Entry to make it work, but as an intermediate step even just keeping the
> original version as provided and not overwriting it with the Java 9 version
> would be an improvement.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)