apache / apache/maven-shade-plugin
[MSHADE-435] Add parameter to ignore project artifact for excludes filtering
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Marcono1234](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=marcono1234)** opened **[MSHADE-435](https://issues.apache.org/jira/browse/MSHADE-435?redirect=false)** and commented
### The problem
When specifying wildcard `exclude` filters with `*:*` it is often desired to only remove the classes and resources from dependencies, but not from the artifact of the project which is currently built.
Examples for this are `module-info.class` files (see MSHADE-300), and more recently due to MSHADE-306 all kind of common resource files, e.g. `META-INF/MANIFEST.MF` (for non OSGi projects), `META-INF/NOTICE`, ...
See also [this recent Stack Overflow question](https://stackoverflow.com/q/64110058).
Unfortunately it is not easily possible at the moment to remove the files from dependencies only, but to keep the project resources (without a warning from the shade plugin) because filters always apply to the project artifact too, so you would end up excluding for example your own `MANIFEST.MF` file as well.
According to the [documentation](https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#filters) it is also not possible to specify some kind of "keep" filter which counteracts the wildcard exclude filter because inclusions are always evaluated before exclusions.
### Possible solution
One possible solution would be to add a new `considerProjectArtifact` parameter or similar with default value `true` for `filter` elements. When set to `false` the files from the project artifact are not considered.
This is mainly from the perspective of exclusions, not sure how `considerProjectArtifact` should behave for inclusions.
---
**Affects:** 3.4.1
**Issue Links:**
- [MSHADE-300](https://issues.apache.org/jira/browse/MSHADE-300) Allow retention of module-info class by property
- [MSHADE-306](https://issues.apache.org/jira/browse/MSHADE-306) Log all duplicates, not only classes
1 votes, 2 watchers
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Maven Shade Plugin filter configuration and the filters documentation described in the issue, using MSHADE-300 and MSHADE-306 for context. Define the project-artifact handling, including the unresolved behavior for inclusions, and verify that dependency exclusions preserve project resources without warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100