Class PathConflictResolver
- java.lang.Object
-
- org.eclipse.aether.util.graph.transformer.ConflictResolver
-
- org.eclipse.aether.util.graph.transformer.PathConflictResolver
-
- All Implemented Interfaces:
org.eclipse.aether.collection.DependencyGraphTransformer
public final class PathConflictResolver extends ConflictResolver
A dependency graph transformer that resolves version and scope conflicts among dependencies. This resolver builds a cycle-free parallel path tree from the dependency graph, then processes conflict groups in topologically sorted order to select winners.For a given set of conflicting nodes, one node will be chosen as the winner. How losing nodes are handled depends on the configured verbosity level: they may be removed entirely, have their children removed, or be left in place with conflict information. 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.OptionalitySelectorandConflictResolver.ScopeDeriver.Algorithm Overview:
- Path Tree Construction: Builds a cycle-free parallel tree structure from the input
dependency graph, where each
Pathrepresents a unique route to a dependency node. To avoid exponential memory use in highly connected graphs, subtree expansion of eachDependencyNodeinstance is bounded: when the same node is reached again via a different parent path, aPathentry is still created for it (so all occurrences appear in the conflict partition), but its subtree is only re-traversed if reached at a strictly shallower depth than before. - Conflict Partitioning: Groups paths by conflict ID (based on groupId:artifactId:classifier:extension coordinates)
- Topological Processing: Processes conflict groups in topologically sorted order
- Winner Selection: Uses provided selectors to choose winners within each conflict group
- Graph Transformation: Applies changes back to the original dependency graph
Key Differences from
ClassicConflictResolver:- Memory Strategy: Uses parallel tree structure vs in-place graph modification
- Cycle Handling: Explicitly breaks cycles during tree construction
- Processing Order: Level-by-level from root vs depth-first traversal
Implementation Note: This conflict resolver builds a cycle-free "parallel" structure based on the passed-in dependency graph, and applies operations level by level starting from the root. The parallel
Pathtree ensures that cycles in the original graph don't affect the conflict resolution algorithm's performance.- Since:
- 2.0.11
- See Also:
ClassicConflictResolver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver
ConflictResolver.OptionalitySelector, ConflictResolver.ScopeDeriver, ConflictResolver.ScopeSelector, ConflictResolver.Verbosity, ConflictResolver.VersionSelector
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFIG_PROP_SHOW_CYCLES_IN_STANDARD_VERBOSITYThis implementation of conflict resolver is able to show more precise information regarding cycles in standard verbose mode.static booleanDEFAULT_SHOW_CYCLES_IN_STANDARD_VERBOSITY-
Fields inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver
AUTO_CONFLICT_RESOLVER, CLASSIC_CONFLICT_RESOLVER, CONFIG_PROP_CONFLICT_RESOLVER_IMPL, CONFIG_PROP_VERBOSE, DEFAULT_CONFLICT_RESOLVER_IMPL, NODE_DATA_ORIGINAL_OPTIONALITY, NODE_DATA_ORIGINAL_SCOPE, NODE_DATA_WINNER, PATH_CONFLICT_RESOLVER
-
-
Constructor Summary
Constructors Constructor Description PathConflictResolver(ConflictResolver.VersionSelector versionSelector, ConflictResolver.ScopeSelector scopeSelector, ConflictResolver.OptionalitySelector optionalitySelector, ConflictResolver.ScopeDeriver scopeDeriver)Creates a new conflict resolver instance with the specified hooks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.aether.graph.DependencyNodetransformGraph(org.eclipse.aether.graph.DependencyNode node, org.eclipse.aether.collection.DependencyGraphTransformationContext context)-
Methods inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver
getVerbosity
-
-
-
-
Field Detail
-
CONFIG_PROP_SHOW_CYCLES_IN_STANDARD_VERBOSITY
public static final java.lang.String CONFIG_PROP_SHOW_CYCLES_IN_STANDARD_VERBOSITY
This implementation of conflict resolver is able to show more precise information regarding cycles in standard verbose mode. But, to make it really drop-in-replacement, we "tame down" this information. Still, users needing it may want to enable this for easier cycle detection, but in that case this conflict resolver will provide "extra nodes" not present on "standard verbosity level" with "classic" conflict resolver, that may lead to IT issues down the stream. Hence, the default is to provide as much information as much verbose "classic" does.- Since:
- 2.0.12
- See Also:
- Constant Field Values
-
DEFAULT_SHOW_CYCLES_IN_STANDARD_VERBOSITY
public static final boolean DEFAULT_SHOW_CYCLES_IN_STANDARD_VERBOSITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PathConflictResolver
public PathConflictResolver(ConflictResolver.VersionSelector versionSelector, ConflictResolver.ScopeSelector scopeSelector, ConflictResolver.OptionalitySelector optionalitySelector, ConflictResolver.ScopeDeriver scopeDeriver)
Creates a new conflict resolver instance with the specified hooks.- Parameters:
versionSelector- the version selector to use, must not benullscopeSelector- the scope selector to use, must not benulloptionalitySelector- the optionality selector ot use, must not benullscopeDeriver- the scope deriver to use, must not benull
-
-
Method Detail
-
transformGraph
public org.eclipse.aether.graph.DependencyNode transformGraph(org.eclipse.aether.graph.DependencyNode node, org.eclipse.aether.collection.DependencyGraphTransformationContext context) throws org.eclipse.aether.RepositoryException
- Specified by:
transformGraphin interfaceorg.eclipse.aether.collection.DependencyGraphTransformer- Overrides:
transformGraphin classConflictResolver- Throws:
org.eclipse.aether.RepositoryException
-
-