Class ConflictResolver.VersionSelector
java.lang.Object
org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector
- Direct Known Subclasses:
ConfigurableVersionSelector
,NearestVersionSelector
- Enclosing class:
ConflictResolver
An extension point of
ConflictResolver
that determines the winner among conflicting dependencies. The
winning node (and its children) will be retained in the dependency graph, the other nodes will get removed. The
version selector does not need to deal with potential scope conflicts, these will be addressed afterwards by the
ConflictResolver.ScopeSelector
.
Note: Implementations must be stateless.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetInstance
(org.eclipse.aether.graph.DependencyNode root, org.eclipse.aether.collection.DependencyGraphTransformationContext context) Retrieves the version selector for use during the specified graph transformation.abstract void
Determines the winning node among conflicting dependencies.
-
Constructor Details
-
VersionSelector
public VersionSelector()
-
-
Method Details
-
getInstance
public ConflictResolver.VersionSelector getInstance(org.eclipse.aether.graph.DependencyNode root, org.eclipse.aether.collection.DependencyGraphTransformationContext context) throws org.eclipse.aether.RepositoryException Retrieves the version selector for use during the specified graph transformation. The conflict resolver calls this method once perConflictResolver.transformGraph(DependencyNode, DependencyGraphTransformationContext)
invocation to allow implementations to prepare any auxiliary data that is needed for their operation. Given that implementations must be stateless, a new instance needs to be returned to hold such auxiliary data. The default implementation simply returns the current instance which is appropriate for implementations which do not require auxiliary data.- Parameters:
root
- The root node of the (possibly cyclic!) graph to transform, must not benull
.context
- The graph transformation context, must not benull
.- Returns:
- The scope deriver to use for the given graph transformation, never
null
. - Throws:
org.eclipse.aether.RepositoryException
- If the instance could not be retrieved.
-
selectVersion
public abstract void selectVersion(ConflictResolver.ConflictContext context) throws org.eclipse.aether.RepositoryException 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.- Parameters:
context
- The conflict context, must not benull
.- Throws:
org.eclipse.aether.RepositoryException
- If the version selection failed.
-