wilx opened a new pull request, #833:
URL: https://github.com/apache/maven-shade-plugin/pull/833
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 has a meaningful subject line and
body.
- [x] The pull request title uses the corresponding MSHADE issue number.
- [x] The pull request description explains what the pull request does,
how, and why.
- [x] `mvn clean verify` passes.
- [x] The integration tests pass with `mvn -Prun-its clean verify`.
## Summary
Add an optional `inputClassifier` parameter that lets the Shade Plugin use an
artifact attached to the current project as its primary input. When the
parameter is omitted or blank, the plugin continues to use the project's main
artifact.
## Root cause
The plugin always used `MavenProject#getArtifact()` as the primary input. A
plugin could produce and attach a classified JAR before the shade execution,
but Shade had no way to select it. Projects that intentionally produced only
the classified artifact consequently failed because the main artifact did not
exist.
## Implementation
The selected attachment is found directly in the current project's attached
artifacts. Missing and ambiguous classifier selections fail with actionable
messages. The selected artifact is then used consistently for artifact-set
selection, archive filtering, and minimization.
When the shaded artifact is not attached separately, it retains the existing
output semantics and becomes the project's main artifact. The original
classified input remains attached and is not overwritten.
The new integration test covers selection of a classified input, archive
filtering, dependency minimization, preservation of the input attachment, and
installation of the shaded JAR as the main artifact. Unit tests cover
default,
successful, missing, and ambiguous selection.
## Verification
- `mvn clean verify` — 76 tests passed
- `mvn -Prun-its clean verify` — 84 integration tests passed; 2 existing
JRE-dependent tests were skipped under Java 8
- The focused reproducer also passed under Maven 4.0.0-rc-5
Fixes #516.
To make clear that I license this contribution under the
[Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0),
I acknowledge this 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]