Class TransitiveDependencyManager

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

    public final class TransitiveDependencyManager
    extends AbstractDependencyManager
    A dependency manager that provides proper transitive dependency management for modern Maven usage.

    Overview

    This manager implements proper "transitive dependency management" that works harmoniously with Maven's ModelBuilder. It produces more precise results regarding versions by respecting transitive management rules while allowing higher-level management to override lower-level rules.

    Key Characteristics

    • Transitive Management: deriveUntil=Integer.MAX_VALUE, applyFrom=2
    • ModelBuilder Friendly: Works in conjunction with, not against, ModelBuilder
    • Inheritance Aware: Special handling for scope and optional properties
    • Precise Versioning: Obeys transitive management unless managed at higher levels

    Inheritance Handling

    This manager provides special care for "scope" and "optional" properties that are subject to inheritance in the dependency graph during later graph transformation steps. These properties are only derived from the root to prevent interference with inheritance logic.

    When to Use

    This is the recommended manager for modern Maven projects that need proper transitive dependency management while maintaining compatibility with Maven's ModelBuilder.

    Comparison with Other Managers

    Since:
    1.4.0
    Author:
    Christian Schulte
    See Also:
    ClassicDependencyManager, DefaultDependencyManager
    • Constructor Detail

      • TransitiveDependencyManager

        public TransitiveDependencyManager()
        Creates a new dependency manager without any management information.
      • TransitiveDependencyManager

        public TransitiveDependencyManager​(org.eclipse.aether.scope.ScopeManager scopeManager)
        Creates a new transitive dependency manager with ModelBuilder-compatible behavior.

        This constructor initializes the manager with settings optimized for modern Maven usage:

        • deriveUntil = Integer.MAX_VALUE (collect management rules at all levels)
        • applyFrom = 2 (apply management starting from depth 2, respecting ModelBuilder)
        • Special inheritance handling for scope and optional properties
        Parameters:
        scopeManager - application-specific scope manager for handling system dependencies, may be null to use legacy system dependency scope handling
    • Method Detail

      • isInheritedDerived

        protected boolean isInheritedDerived()
        Controls inheritance-based property derivation for scope and optional properties.

        Why scope and optional are special: In dependency graphs, these two properties are subject to inheritance during graph transformation (which is outside ModelBuilder's scope). Therefore, scope and optional are derived only from the root to prevent interference with inheritance logic.

        The inheritance problem: If we managed scope/optional from sources below the root, we would mark nodes as "managed" in the dependency graph. The "managed" flag means "do not touch it, it is as it should be", which would prevent proper inheritance application during later graph transformation, causing nodes to end up with incorrect scope or optional states.

        Special case: The "system" scope has special handling due to its unique path requirements.

        Overrides:
        isInheritedDerived in class AbstractDependencyManager
        Returns:
        true only at depth 0 (root level) to ensure inheritance-based properties are only derived from the root, false otherwise