wilx opened a new pull request, #831:
URL: https://github.com/apache/maven-shade-plugin/pull/831
Fixes #672.
Fixes #652.
## Summary
Preserve multi-release JAR semantics when dependencies are incorporated into
a
shaded artifact.
The shaded manifest now receives `Multi-Release: true` when any included
input
is a multi-release JAR. An explicit `Multi-Release: false` remains
authoritative
and produces a warning explaining that versioned entries will not be active.
Relocation now operates on the logical path below
`META-INF/versions/<release>/`, so versioned classes and resources remain
aligned with their root entries. Minimization likewise treats all physical
versions of a class as the same logical class. Root and versioned
`module-info.class` entries continue to be discarded; this change does not
introduce module descriptor merging.
## Root cause
Shade copied versioned entries but retained only the first input manifest.
This could leave the versioned entries inactive. Relocation also evaluated
the
physical `META-INF/versions/<release>/...` path, which prevented ordinary
package relocation rules from matching versioned classes and resources.
Finally, minimization treated a versioned class path as a distinct class
name.
## Tests
The new integration coverage:
* reproduces the record-deserialization failure from MSHADE-460 using Yasson;
* verifies manifest propagation;
* verifies root and Java 11 class and resource relocation;
* verifies runtime selection of the relocated Java 11 resource;
* verifies minimization across release variants; and
* verifies removal of a versioned module descriptor.
Validation performed with JDK 17:
* `mvn clean verify` — 76 tests passed;
* `mvn -Prun-its clean verify` — 86 integration projects passed and one
existing JRE-gated project was skipped.
Both generated multi-release JARs also pass JDK 21 `jar --validate` and
execute
successfully on JDK 21.
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Make sure there is a [JIRA
issue](https://issues.apache.org/jira/browse/MSHADE) filed
for the change (usually before you start working on it). Trivial
changes like typos do not
require a JIRA issue. Your pull request should address just this
issue, without
pulling in other changes.
- [x] Each commit in the pull request should have a meaningful subject line
and body.
- [x] Format the pull request title like `[MSHADE-XXX] - Fixes bug in
ApproximateQuantiles`,
where you replace `MSHADE-XXX` with the appropriate JIRA issue. Best
practice
is to use the JIRA issue title in the pull request title and in the
first line of the
commit message.
- [x] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [x] Run `mvn clean verify` to make sure basic checks pass. A more
thorough check will
be performed on your pull request automatically.
- [x] You have run the integration tests successfully (`mvn -Prun-its clean
verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]