slachiewicz opened a new issue, #870:
URL: https://github.com/apache/maven-shade-plugin/issues/870

   An `<artifactSet>` include or exclude that matches no artifact is ignored 
without a word at the default log level. A typo in an include, or an include 
left behind after a dependency is removed, goes unnoticed: the shaded jar lacks 
the artifact the author meant to bundle, or the stale entry stays in the POM 
indefinitely.
   
   `ArtifactSelector.isSelected` 
([ArtifactSelector.java:71-82](https://github.com/apache/maven-shade-plugin/blob/master/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java#L71-L82))
 tests one artifact against the patterns and keeps no record of which patterns 
ever matched, and `ShadeMojo` logs excluded artifacts only at debug 
([ShadeMojo.java:848-850](https://github.com/apache/maven-shade-plugin/blob/master/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L848-L850)).
 The `<filters>` counterpart already detects the case, `No artifact matching 
filter …` 
([ShadeMojo.java:1031](https://github.com/apache/maven-shade-plugin/blob/master/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L1031)),
 but also logs it only at debug.
   
   An example from Apache XTable: `xtable-hive-metastore` carries 36 shade 
includes that are not in the module's runtime dependency tree, left behind as 
Hive dependencies were trimmed (apache/incubator-xtable#990). The build 
reported nothing; a project script comparing the includes with 
`dependency:tree` found them.
   
   ## Proposal
   
   After the artifacts are selected, log at WARN each `artifactSet` include and 
exclude pattern that matched none of the project's artifacts. Skip the patterns 
the plugin adds itself: the project's own artifact and the `shadedGroupFilter` 
prefix. Raise the existing filter no-match message to WARN in the same change.
   
   Excludes that match nothing are common, for example `org.slf4j:*` inherited 
from a parent `pluginManagement` into a module without SLF4J, so unmatched 
excludes could be reported at INFO instead. Failing the build is out of scope; 
a warning is enough to make the drift visible.
   
   #849 (for #756) puts the filter no-match message behind a `verbose` option. 
That option restores the listing of what was included; a pattern that matched 
nothing is a configuration mistake and is worth reporting without it.
   
   `PatternIncludesArtifactFilter.reportMissedCriteria` in 
maven-common-artifact-filters gives maven-assembly-plugin and 
maven-dependency-plugin the same warning. Shade has its own `ArtifactSelector`, 
so the change stays in this plugin.
   


-- 
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]

Reply via email to