[MRESOLVER-379] Preserve relocated candidates from version ranges - #2114
Open
jjj-n wants to merge 1 commit into
Open
[MRESOLVER-379] Preserve relocated candidates from version ranges#2114jjj-n wants to merge 1 commit into
jjj-n wants to merge 1 commit into
Conversation
Dependency collection returned from processDependency as soon as a range candidate had relocations. This kept only the first DF candidate or the first reverse-ordered BF candidate in the dirty tree. Continue with the remaining VersionRangeResult candidates after the relocation chain has been processed, and update the existing BF/DF fixtures to assert that all relocated versions remain visible.
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.
Summary
Problem
For a dependency such as
A:1 -> B:[1,3], whereB:1,B:2, andB:3relocate toC:1,C:2, andC:3, the relocation branchreturned from
processDependencyafter processing one range candidate.As a result:
C:1.C:3, because BF iterates range candidates indescending order.
The remaining versions from
VersionRangeResultwere never processed.Fix
Replace the method-level
returnwith a loop-levelcontinuein therelocation branches of both collectors.
This completes processing of the current relocation chain and then
resumes the surrounding range-candidate loop. Version selection and
conflict resolution behavior are unchanged.
Tests
The existing
testTransitiveDepsUseRangesAndRelocationDirtyTreetest is inherited byall three concrete collector test variants.
Red phase, before the runtime change:
C:1).C:3).C:3).Green phase:
maven-resolver-impland prerequisite reactor modules: 1,223 tests,0 failures, 0 errors.
mvn verify: the first 14 reactor modules passedbefore
FileTransporterTesthit three unrelated symbolic-linkprivilege errors.
reactor modules passed, including all production modules. The
unrelated
maven-resolver-demo-snippetsmodule later failed whiledownloading Guava 19.0 from Maven Central with a connection timeout.
Fixes #1051
This change was created with AI assistance and manually reviewed and tested.
Following this checklist to help us incorporate your
contribution quickly and easily:
mvn verifycompleted successfully. It was attempted; allproduction modules passed, but local verification was blocked by
Windows symbolic-link privileges and a Maven Central connection timeout.
mvn -Prun-its verifycompleted successfully. The additional ITprofiles are unrelated to the modified collector behavior and were
not run after the external-network failure above.
Apache License Version 2.0, January 2004
Apache Individual Contributor License Agreement.