[ 
https://issues.apache.org/jira/browse/MASSEMBLY-891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16547566#comment-16547566
 ] 

Joachim Sauer commented on MASSEMBLY-891:
-----------------------------------------

I've since realized that this problem will only occur when running Maven using 
Java 10 (possibly Java 9 as well, haven't tried that). Switching the build to 
use Java 8 "fixed" the issue, which is a little unexpected.

> 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
>
> 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)

Reply via email to