Class TransitiveDependencyManager
- All Implemented Interfaces:
org.eclipse.aether.collection.DependencyManager
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:
-
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
ConstructorsConstructorDescriptionDeprecated.TransitiveDependencyManager
(org.eclipse.aether.scope.ScopeManager scopeManager) Creates a new transitive dependency manager with ModelBuilder-compatible behavior. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Controls inheritance-based property derivation for scope and optional properties.protected org.eclipse.aether.collection.DependencyManager
newInstance
(MMap<AbstractDependencyManager.Key, String> managedVersions, MMap<AbstractDependencyManager.Key, String> managedScopes, MMap<AbstractDependencyManager.Key, Boolean> managedOptionals, MMap<AbstractDependencyManager.Key, String> managedLocalPaths, MMap<AbstractDependencyManager.Key, AbstractDependencyManager.Holder<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 Details
-
TransitiveDependencyManager
Deprecated.UseTransitiveDependencyManager(ScopeManager)
instead to provide application-specific scope management. This constructor uses legacy system dependency scope handling.Creates a new dependency manager without any management information. -
TransitiveDependencyManager
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 Details
-
newInstance
protected org.eclipse.aether.collection.DependencyManager newInstance(MMap<AbstractDependencyManager.Key, String> managedVersions, MMap<AbstractDependencyManager.Key, String> managedScopes, MMap<AbstractDependencyManager.Key, Boolean> managedOptionals, MMap<AbstractDependencyManager.Key, String> managedLocalPaths, MMap<AbstractDependencyManager.Key, AbstractDependencyManager.Holder<Collection<org.eclipse.aether.graph.Exclusion>>> managedExclusions) - Specified by:
newInstance
in classAbstractDependencyManager
-
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 classAbstractDependencyManager
- Returns:
- true only at depth 0 (root level) to ensure inheritance-based properties are only derived from the root, false otherwise
-
TransitiveDependencyManager(ScopeManager)
instead to provide application-specific scope management.