Class AbstractDependencyManager
- All Implemented Interfaces:
org.eclipse.aether.collection.DependencyManager
- Direct Known Subclasses:
ClassicDependencyManager
,DefaultDependencyManager
,TransitiveDependencyManager
This implementation is Maven specific, as it works hand-in-hand along with Maven ModelBuilder. While model builder handles dependency management in the context of single POM (inheritance, imports, etc.), this implementation carries in-lineage modifications based on previously recorded dependency management rules sourced from ascendants while building the dependency graph. Root sourced management rules are special, in a way they are always applied, while en-route collected ones are carefully applied to proper descendants only, to not override work done by model builder already.
Details: Model builder handles version, scope from own dependency management (think "effective POM"). On the other hand it does not handle optional for example. System paths are aligned across whole graph, making sure there is same system path used by same dependency. Finally, exclusions (exclusions are additional information not effective or applied in same POM) are always applied. This implementation makes sure, that version and scope are not applied onto same node that actually provided the rules, to no override work that ModelBuilder did. It achieves this goal by tracking "depth" for each collected rule and ignoring rules coming from same depth as processed dependency node is.
Note for future: the field managedLocalPaths
is intentionally left out of hash/equals, with
reason explained above.
Implementation note for all managers extending this class: this class maintains "path" (list of parent managers)
and "depth". Depth 0
is basically used as "factory" on session; is the instance created during session
creation and is usually empty (just parameterized). Depth 1 is the current collection "root", depth 2
are direct dependencies, depth 3 first level of transitive dependencies of direct dependencies and so on. Hence, on
depth 1 (the collection root, initialized with management possibly as well) parent will be always the empty "factory"
instance, and we need special handling: "apply onto itself". This does not stand on depth > 1.
- Since:
- 2.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Wrapper class for collection to memoize hash code.protected static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
protected final int
protected final int
protected final MMap
<AbstractDependencyManager.Key, AbstractDependencyManager.Holder<Collection<org.eclipse.aether.graph.Exclusion>>> protected final MMap
<AbstractDependencyManager.Key, String> protected final MMap
<AbstractDependencyManager.Key, Boolean> protected final MMap
<AbstractDependencyManager.Key, String> protected final MMap
<AbstractDependencyManager.Key, String> protected final ArrayList
<AbstractDependencyManager> protected final org.eclipse.aether.scope.SystemDependencyScope
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractDependencyManager
(int deriveUntil, int applyFrom, org.eclipse.aether.scope.ScopeManager scopeManager) protected
AbstractDependencyManager
(ArrayList<AbstractDependencyManager> path, int depth, int deriveUntil, int applyFrom, 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, org.eclipse.aether.scope.SystemDependencyScope systemDependencyScope) -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.aether.collection.DependencyManager
deriveChildManager
(org.eclipse.aether.collection.DependencyCollectionContext context) boolean
int
hashCode()
protected boolean
Returnstrue
if current dependency should be managed according to so far collected/derived rules.protected boolean
Returnstrue
if current context should be factored in (collected/derived).org.eclipse.aether.collection.DependencyManagement
manageDependency
(org.eclipse.aether.graph.Dependency dependency) protected abstract 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)
-
Field Details
-
path
-
depth
-
deriveUntil
-
applyFrom
-
managedVersions
-
managedScopes
-
managedOptionals
-
managedLocalPaths
-
managedExclusions
protected final MMap<AbstractDependencyManager.Key,AbstractDependencyManager.Holder<Collection<org.eclipse.aether.graph.Exclusion>>> managedExclusions -
systemDependencyScope
-
-
Constructor Details
-
AbstractDependencyManager
protected AbstractDependencyManager(int deriveUntil, int applyFrom, org.eclipse.aether.scope.ScopeManager scopeManager) -
AbstractDependencyManager
protected AbstractDependencyManager(ArrayList<AbstractDependencyManager> path, int depth, int deriveUntil, int applyFrom, 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, org.eclipse.aether.scope.SystemDependencyScope systemDependencyScope)
-
-
Method Details
-
newInstance
protected abstract 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) -
deriveChildManager
public org.eclipse.aether.collection.DependencyManager deriveChildManager(org.eclipse.aether.collection.DependencyCollectionContext context) - Specified by:
deriveChildManager
in interfaceorg.eclipse.aether.collection.DependencyManager
-
manageDependency
public org.eclipse.aether.collection.DependencyManagement manageDependency(org.eclipse.aether.graph.Dependency dependency) - Specified by:
manageDependency
in interfaceorg.eclipse.aether.collection.DependencyManager
-
isDerived
Returnstrue
if current context should be factored in (collected/derived). -
isApplied
Returnstrue
if current dependency should be managed according to so far collected/derived rules. -
equals
-
hashCode
-