Fix dependency-reduced-pom exclusion loss for classifier-distinct duplicate deps (Maven 4)#820
Open
ascheman wants to merge 1 commit into
Open
Conversation
Under Maven 4, ShadeMojo.updateExcludesInDeps() walks a single
conflict-resolved collect graph. The resolver prunes the duplicate
transitive node ("omitted for duplicate") under one of two
classifier-distinct variants of the same artifact, so the generated
dependency-reduced-pom keeps the <exclusion> on only one variant.
Collect that graph with verbose conflict resolution
(ConflictResolver.CONFIG_PROP_VERBOSE = STANDARD) so the omitted-duplicate
node is retained as a marker; the existing walk then re-attaches the
exclusion to both variants. No behaviour change on Maven 3.9.16.
Covered by the existing dep-reduced-pom-exclusions and
MSHADE-467_parallel-dependency-reduced-pom ITs.
Closes apache#819
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Note on Maven 4 coverage: this repo's PR matrix runs Maven 3.9.16 only, so the green checks here confirm there is no Maven 3 regression but do not exercise the Maven 4 path this fixes. For the Maven 4 evidence I ran the full
Locally the suite is also 83/0 on both Maven 4.0.0-SNAPSHOT and Maven 3.9.16. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the generated
dependency-reduced-pom.xmldropping an<exclusion>on one of two classifier-distinct duplicate variants of a dependency under Maven 4 (e.g.b:0.2keeps the exclusion,b:0.2:altloses it).Why
ShadeMojo.updateExcludesInDeps()walks a single conflict-resolved collect graph. Under Maven 4 the resolver prunes the duplicate transitive node (omitted for duplicate) under one variant, so the exclusion is re-attached to only that variant. This is stable, intended resolver behaviour (not a resolver bug); shade's own dependency keying is already classifier-aware.Fix
Collect that graph with verbose conflict resolution (
ConflictResolver.CONFIG_PROP_VERBOSE = STANDARD) on a copied session, so the omitted-duplicate node is retained as a marker; the existing walk then re-attaches the exclusion to both variants. Localized to the singlecollectDependenciescall; no behaviour change on Maven 3.Test
Covered by the existing ITs
dep-reduced-pom-exclusionsandMSHADE-467_parallel-dependency-reduced-pom(red on Maven 4 / green on Maven 3 before; green on both after). Full-P run-itsverified locally: 83/0 on both Maven 4.0.0-SNAPSHOT and Maven 3.9.16.Closes #819