Class ClassicConflictResolver

  • All Implemented Interfaces:
    org.eclipse.aether.collection.DependencyGraphTransformer

    public final class ClassicConflictResolver
    extends ConflictResolver
    A legacy dependency graph transformer that resolves version and scope conflicts among dependencies. This implementation maintains backward compatibility with Maven 3.x and Resolver 1.x behavior but has O(N²) worst-case performance characteristics. For new projects, consider using PathConflictResolver.

    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²) worst-case where N is the number of dependency nodes
    • Memory Usage: Modifies the dependency graph in-place
    • Scalability: Performance degrades significantly on large multi-module projects

    Algorithm Overview:

    1. Depth-First Traversal: Walks the dependency graph depth-first
    2. In-Place Modification: Modifies nodes directly during traversal
    3. Conflict Detection: Identifies conflicts by comparing conflict IDs
    4. Winner Selection: Uses provided selectors to choose winners
    5. Loser Removal: Removes or marks losing nodes during traversal

    When to Use:

    • Exact backward compatibility with Maven 3.x/Resolver 1.x is required
    • Debugging performance differences between old and new algorithms
    • Small projects where performance is not a concern
    • Testing and validation scenarios

    Migration Recommendation: New projects should use PathConflictResolver for better performance. This implementation is retained primarily for compatibility and testing purposes.

    Implementation Note: This conflict resolver is identical to the one used in Maven 3/Resolver 1.x. The implementation may produce O(N²) worst-case performance on projects with many small conflict groups (typically one member each), which is common in large multi-module projects.

    Since:
    2.0.11
    See Also:
    PathConflictResolver
    • 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:
        transformGraph in interface org.eclipse.aether.collection.DependencyGraphTransformer
        Overrides:
        transformGraph in class ConflictResolver
        Throws:
        org.eclipse.aether.RepositoryException