You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Niels Basjes (Jira)" <ji...@apache.org> on 2023/03/09 12:18:00 UTC

[jira] [Commented] (MSHADE-439) Relocate does not relocate the other JVM variants in Multi Release jar.

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

Niels Basjes commented on MSHADE-439:
-------------------------------------

The attached {{pom.xml}} is the smallest reproduction I could make.

- Put in empty directory
- mvn package
- unzip -l target/relocate-0.jar | fgrep Logger

This is the output:
{code}
     1678  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger$Level.class
     1484  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger.class
     1579  2023-02-26 11:06   nl/basjes/shaded/org/yaml/snakeyaml/internal/Logger$Level.class
     1383  2023-02-26 11:06   nl/basjes/shaded/org/yaml/snakeyaml/internal/Logger.class
{code}

> Relocate does not relocate the other JVM variants in Multi Release jar.
> -----------------------------------------------------------------------
>
>                 Key: MSHADE-439
>                 URL: https://issues.apache.org/jira/browse/MSHADE-439
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 3.4.1
>            Reporter: Niels Basjes
>            Priority: Major
>         Attachments: pom.xml
>
>
> The 2.0 release of snakeyaml is a _Multi Release jar (See this [commit|https://bitbucket.org/snakeyaml/snakeyaml/commits/b33f0ca7507fd61fc945722b5d14de4b0aff5262])_.
> For 2 class files they actually package a *standard* and a *java 9* variant of the same thing.
> {code:java}
> $ unzip -l ~/.m2/repository/org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar | fgrep Logger
>      1545  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger$Level.class
>      1365  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger.class
>      1446  2023-02-26 11:06   org/yaml/snakeyaml/internal/Logger$Level.class
>      1264  2023-02-26 11:06   org/yaml/snakeyaml/internal/Logger.class
> {code}
> When I use the maven-shade-plugin 3.4.1 (latest at the time of writing) to shade this dependency in my project and relocate (!) it to a different package the final jar contains this:
> {code:java}
>      1678  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger$Level.class
>      1484  2023-02-26 11:06   META-INF/versions/9/org/yaml/snakeyaml/internal/Logger.class
>      1579  2023-02-26 11:06   nl/basjes/shaded/org/yaml/snakeyaml/internal/Logger$Level.class
>      1383  2023-02-26 11:06   nl/basjes/shaded/org/yaml/snakeyaml/internal/Logger.class
> {code}
> Note that the *standard* variants have been shaded correctly and the *java 9* variants have not been relocated at all.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)