Class TransitiveDependencyManager
- java.lang.Object
-
- org.eclipse.aether.util.graph.manager.AbstractDependencyManager
-
- org.eclipse.aether.util.graph.manager.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
ClassicDependencyManager: Maven 2.x compatibility, limited transitive supportDefaultDependencyManager: Aggressive but interferes with ModelBuilder- This manager: Modern, transitive, ModelBuilder-compatible (recommended)
- Since:
- 1.4.0
- Author:
- Christian Schulte
- See Also:
ClassicDependencyManager,DefaultDependencyManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.aether.util.graph.manager.AbstractDependencyManager
AbstractDependencyManager.Holder<T>, AbstractDependencyManager.Key
-
-
Field Summary
-
Fields inherited from class org.eclipse.aether.util.graph.manager.AbstractDependencyManager
applyFrom, depth, deriveUntil, managedExclusions, managedLocalPaths, managedOptionals, managedScopes, managedVersions, path, systemDependencyScope
-
-
Constructor Summary
Constructors Constructor Description TransitiveDependencyManager()Creates a new dependency manager without any management information.TransitiveDependencyManager(org.eclipse.aether.scope.ScopeManager scopeManager)Creates a new transitive dependency manager with ModelBuilder-compatible behavior.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanisInheritedDerived()Controls inheritance-based property derivation for scope and optional properties.protected org.eclipse.aether.collection.DependencyManagernewInstance(MMap<AbstractDependencyManager.Key,java.lang.String> managedVersions, MMap<AbstractDependencyManager.Key,java.lang.String> managedScopes, MMap<AbstractDependencyManager.Key,java.lang.Boolean> managedOptionals, MMap<AbstractDependencyManager.Key,java.lang.String> managedLocalPaths, MMap<AbstractDependencyManager.Key,AbstractDependencyManager.Holder<java.util.Collection<org.eclipse.aether.graph.Exclusion>>> managedExclusions)-
Methods inherited from class org.eclipse.aether.util.graph.manager.AbstractDependencyManager
deriveChildManager, equals, hashCode, isApplied, isDerived, manageDependency
-
-
-
-
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
-
newInstance
protected org.eclipse.aether.collection.DependencyManager newInstance(MMap<AbstractDependencyManager.Key,java.lang.String> managedVersions, MMap<AbstractDependencyManager.Key,java.lang.String> managedScopes, MMap<AbstractDependencyManager.Key,java.lang.Boolean> managedOptionals, MMap<AbstractDependencyManager.Key,java.lang.String> managedLocalPaths, MMap<AbstractDependencyManager.Key,AbstractDependencyManager.Holder<java.util.Collection<org.eclipse.aether.graph.Exclusion>>> managedExclusions)
- Specified by:
newInstancein classAbstractDependencyManager
-
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:
isInheritedDerivedin classAbstractDependencyManager- Returns:
- true only at depth 0 (root level) to ensure inheritance-based properties are only derived from the root, false otherwise
-
-