apache / apache/maven-shade-plugin
[MSHADE-439] Relocate does not relocate the other JVM variants in Multi Release jar.
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Niels Basjes](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nielsbasjes)** opened **[MSHADE-439](https://issues.apache.org/jira/browse/MSHADE-439?redirect=false)** and commented
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.
```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
```
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:
```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
```
Note that the **standard** variants have been shaded correctly and the **java 9** variants have not been relocated at all.
---
**Affects:** 3.4.1
**Attachments:**
- [pom.xml](https://issues.apache.org/jira/secure/attachment/13056215/pom.xml) (_3.32 kB_)
1 votes, 3 watchers
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the shaded output with the attached pom.xml, using the snakeyaml 2.0 dependency and checking both standard classes and META-INF/versions/9 classes. Then trace the relocation handling for multi-release JAR entries. Done means the Java 9 variants are relocated consistently with the standard variants and the resulting JAR matches the expected package layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100