Class ConfigurableVersionSelector
java.lang.Object
org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector
org.eclipse.aether.util.graph.transformer.ConfigurableVersionSelector
A configurable version selector for use with
ConflictResolver
that resolves version conflicts using a
specified strategy. If there is no single node that satisfies all encountered version ranges, the selector will fail.
Based on configuration, this selector may fail for other reasons as well.- Since:
- 2.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
static class
Selection strategy that selects "highest" version.static class
Example selection strategy (used in tests and demos), is not recommended to be used in production.static class
Selection strategy that selects "nearest" (to the root) version.static interface
The strategy how "winner" is being selected.static class
Example selection strategy (used in tests and demos), is not recommended to be used in production. -
Field Summary
Modifier and TypeFieldDescriptionprotected final ConfigurableVersionSelector.SelectionStrategy
The strategy of winner selection, nevernull
. -
Constructor Summary
ConstructorDescriptionCreates a new instance of this version selector that works "as Maven did so far".ConfigurableVersionSelector
(ConfigurableVersionSelector.SelectionStrategy selectionStrategy) Creates a new instance of this version selector. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
backtrack
(ConfigurableVersionSelector.ConflictGroup group, ConflictResolver.ConflictContext context) protected boolean
newFailure
(String message, ConflictResolver.ConflictContext context) Helper method to create failure, creates instance ofUnsolvableVersionConflictException
.void
Determines the winning node among conflicting dependencies.Methods inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector
getInstance
-
Field Details
-
selectionStrategy
The strategy of winner selection, nevernull
.
-
-
Constructor Details
-
ConfigurableVersionSelector
public ConfigurableVersionSelector()Creates a new instance of this version selector that works "as Maven did so far". -
ConfigurableVersionSelector
Creates a new instance of this version selector.- Parameters:
selectionStrategy
- The winner selection strategy, must not benull
. Maven3 usedConfigurableVersionSelector.Nearest
strategy.
-
-
Method Details
-
selectVersion
Description copied from class:ConflictResolver.VersionSelector
Determines the winning node among conflicting dependencies. Implementations will usually iterateConflictResolver.ConflictContext.getItems()
, inspectConflictResolver.ConflictItem.getNode()
and eventually callConflictResolver.ConflictContext.setWinner(ConflictResolver.ConflictItem)
to deliver the winner. Failure to select a winner will automatically fail the entire conflict resolution.- Specified by:
selectVersion
in classConflictResolver.VersionSelector
- Parameters:
context
- The conflict context, must not benull
.- Throws:
RepositoryException
- If the version selection failed.
-
backtrack
protected void backtrack(ConfigurableVersionSelector.ConflictGroup group, ConflictResolver.ConflictContext context) throws UnsolvableVersionConflictException -
isAcceptableByConstraints
protected boolean isAcceptableByConstraints(ConfigurableVersionSelector.ConflictGroup group, Version version) -
newFailure
public static UnsolvableVersionConflictException newFailure(String message, ConflictResolver.ConflictContext context) Helper method to create failure, creates instance ofUnsolvableVersionConflictException
.
-