gnodet commented on code in PR #820:
URL:
https://github.com/apache/maven-shade-plugin/pull/820#discussion_r3648692677
##########
src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java:
##########
@@ -1299,7 +1301,15 @@ public boolean updateExcludesInDeps(
d,
session.getRepositorySession().getArtifactTypeRegistry()))
.collect(Collectors.toList()));
}
- CollectResult result =
repositorySystem.collectDependencies(session.getRepositorySession(),
collectRequest);
+ // #819: collect with verbose conflict resolution so that dependencies
omitted as conflict
+ // losers (e.g. a transitive dependency shared by two
classifier-distinct variants of the same
+ // artifact) are retained in the graph as markers. Without this,
conflict resolution under Maven 4
+ // prunes the duplicate node from all but one variant, and the
exclusion is only applied to that
+ // single variant in the dependency-reduced-pom.
+ DefaultRepositorySystemSession verboseSession =
+ new
DefaultRepositorySystemSession(session.getRepositorySession());
+ verboseSession.setConfigProperty(ConflictResolver.CONFIG_PROP_VERBOSE,
ConflictResolver.Verbosity.STANDARD);
Review Comment:
Verified: `ConflictResolver.CONFIG_PROP_VERBOSE` and
`ConflictResolver.Verbosity.STANDARD` are stable, non-deprecated API present in
both Resolver 1.9.x and 2.0.x. The copy constructor of
`DefaultRepositorySystemSession` is also [explicitly
blessed](https://maven.apache.org/resolver-archives/resolver-LATEST/upgrading-resolver.html)
for Mojo use in Resolver 2.x (only the no-arg constructor is deprecated).
The underlying root cause (a cache-transparency violation in
`BfDependencyCollector` where pool cache hit/miss changes graph structure) has
been filed as
[apache/maven-resolver#2013](https://github.com/apache/maven-resolver/issues/2013).
Even if that is fixed, verbose mode is semantically the right choice for this
walk.
--
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]