Class ConflictResolver

java.lang.Object
org.eclipse.aether.util.graph.transformer.ConflictResolver
All Implemented Interfaces:
DependencyGraphTransformer

public final class ConflictResolver extends Object implements DependencyGraphTransformer
A dependency graph transformer that resolves version and scope conflicts among dependencies. For a given set of conflicting nodes, one node will be chosen as the winner and the other nodes are removed from the dependency graph. The exact rules by which a winning node and its effective scope are determined are controlled by user-supplied implementations of ConflictResolver.VersionSelector, ConflictResolver.ScopeSelector, ConflictResolver.OptionalitySelector and ConflictResolver.ScopeDeriver.

By default, this graph transformer will turn the dependency graph into a tree without duplicate artifacts. Using the configuration property CONFIG_PROP_VERBOSE, a verbose mode can be enabled where the graph is still turned into a tree but all nodes participating in a conflict are retained. The nodes that were rejected during conflict resolution have no children and link back to the winner node via the NODE_DATA_WINNER key in their custom data. Additionally, the keys NODE_DATA_ORIGINAL_SCOPE and NODE_DATA_ORIGINAL_OPTIONALITY are used to store the original scope and optionality of each node. Obviously, the resulting dependency tree is not suitable for artifact resolution unless a filter is employed to exclude the duplicate dependencies.

This transformer will query the keys TransformationContextKeys.CONFLICT_IDS, TransformationContextKeys.SORTED_CONFLICT_IDS, TransformationContextKeys.CYCLIC_CONFLICT_IDS for existing information about conflict ids. In absence of this information, it will automatically invoke the ConflictIdSorter to calculate it.