maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G G (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MASSEMBLY-891) Multi-release JAR files aren't handled correctly
Date Mon, 30 Jul 2018 08:24:00 GMT

     [ https://issues.apache.org/jira/browse/MASSEMBLY-891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

G G updated MASSEMBLY-891:
--------------------------
    Attachment: reproducer.zip

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

Mime
View raw message