Class PathConflictResolver
- All Implemented Interfaces:
org.eclipse.aether.collection.DependencyGraphTransformer
ClassicConflictResolver
.
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.OptionalitySelector
and ConflictResolver.ScopeDeriver
.
Performance Characteristics:
- Time Complexity: O(N) where N is the number of dependency nodes
- Memory Usage: Creates a parallel tree structure for conflict-free processing
- Scalability: Excellent performance on large multi-module projects
Algorithm Overview:
- Path Tree Construction: Builds a cycle-free parallel tree structure from the input
dependency graph, where each
Path
represents a unique route to a dependency node - 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
:
- Performance: O(N) vs O(N²) time complexity
- 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
When to Use:
- Default choice for all new projects and Maven 4+ installations
- Large multi-module projects with many dependencies
- Performance-critical build environments
- Any scenario where
ClassicConflictResolver
shows performance bottlenecks
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 Path
tree ensures that cycles in the original graph don't affect the conflict resolution algorithm's performance.
- Since:
- 2.0.11
- See Also:
-
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 inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver
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
ConstructorsConstructorDescriptionPathConflictResolver
(ConflictResolver.VersionSelector versionSelector, ConflictResolver.ScopeSelector scopeSelector, ConflictResolver.OptionalitySelector optionalitySelector, ConflictResolver.ScopeDeriver scopeDeriver) Creates a new conflict resolver instance with the specified hooks. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.aether.graph.DependencyNode
transformGraph
(org.eclipse.aether.graph.DependencyNode node, org.eclipse.aether.collection.DependencyGraphTransformationContext context) Methods inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver
getVerbosity
-
Constructor Details
-
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 benull
.scopeSelector
- The scope selector to use, must not benull
.optionalitySelector
- The optionality selector ot use, must not benull
.scopeDeriver
- The scope deriver to use, must not benull
.
-
-
Method Details
-
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:
transformGraph
in interfaceorg.eclipse.aether.collection.DependencyGraphTransformer
- Overrides:
transformGraph
in classConflictResolver
- Throws:
org.eclipse.aether.RepositoryException
-