in maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/ConfigurableVersionSelector.java [99:131]
public void selectVersion(ConflictContext context) throws RepositoryException {
ConflictGroup group = new ConflictGroup();
for (ConflictItem candidate : context.getItems()) {
DependencyNode node = candidate.getNode();
VersionConstraint constraint = node.getVersionConstraint();
boolean backtrack = false;
boolean hardConstraint = constraint.getRange() != null;
if (hardConstraint) {
if (group.constraints.add(constraint)) {
if (group.winner != null
&& !constraint.containsVersion(
group.winner.getNode().getVersion())) {
backtrack = true;
}
}
}
if (isAcceptableByConstraints(group, node.getVersion())) {
group.candidates.add(candidate);
if (backtrack) {
backtrack(group, context);
} else if (group.winner == null || selectionStrategy.isBetter(candidate, group.winner)) {
group.winner = candidate;
}
} else if (backtrack) {
backtrack(group, context);
}
}
context.setWinner(selectionStrategy.winnerSelected(group.winner, group.candidates, context));
}