Marcono1234 created MSHADE-435:
----------------------------------

             Summary: Add parameter to ignore project artifact for excludes 
filtering
                 Key: MSHADE-435
                 URL: https://issues.apache.org/jira/browse/MSHADE-435
             Project: Maven Shade Plugin
          Issue Type: New Feature
    Affects Versions: 3.4.1
            Reporter: Marcono1234


h3. The problem
When specifying wildcard {{exclude}} filters with {{<artifact>*:*</artifact>}} 
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.

h3. 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.




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

Reply via email to