Package org.mule.maven.client.internal
Class OneInstancePerNodeGraphTransformer
java.lang.Object
org.mule.maven.client.internal.OneInstancePerNodeGraphTransformer
- All Implemented Interfaces:
org.eclipse.aether.collection.DependencyGraphTransformer
public class OneInstancePerNodeGraphTransformer
extends Object
implements org.eclipse.aether.collection.DependencyGraphTransformer
DependencyGraphTransformer implementation that makes sure that there are no DependencyNode instances shared
amongst plugins, apis and non-plugin subtrees.
This transformer was created after finding out that the received graph was reusing instances of DependencyNode. That
caused that, in some cases, the logic implemented by MulePluginDependencyGraphTransformer modified more than the
required nodes. As a consequence, the final dependency graph was wrong.
APP |__plugin | \_lib | \_transitive |__other-lib \_lib \_transitive
TheDependencyNode representing the `transitive` dependency, would be the same for all branches. In that case, when
MulePluginDependencyGraphTransformer changes it's artifactId so that it doesn't conflict with non-plugin dependencies,
since the DependencyNode instance is the same, the artifactId will be changed for multiple branches. That causes the
dependency to be filtered because it will be considered as if it was only declared as a plugin dependency.
To fix this issue, this implementation will recreate all DependencyNodes that hang from a plugin's to make sure that if
it's modified, it only affects that particular instance. For api dependencies, the logic is similar, but we only recreate other
api dependencies. That is because, non-api dependencies should not be considered as dependencies in an "api parent context" and
should conflict with other dependencies in the general graph.- Since:
- 1.4.3, 1.5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.aether.graph.DependencyNodetransformGraph(org.eclipse.aether.graph.DependencyNode node, org.eclipse.aether.collection.DependencyGraphTransformationContext context)
-
Constructor Details
-
OneInstancePerNodeGraphTransformer
public OneInstancePerNodeGraphTransformer()
-
-
Method Details
-
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:
transformGraphin interfaceorg.eclipse.aether.collection.DependencyGraphTransformer- Throws:
org.eclipse.aether.RepositoryException
-