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.| Constructor and Description |
|---|
OneInstancePerNodeGraphTransformer() |
| Modifier and Type | Method and Description |
|---|---|
org.eclipse.aether.graph.DependencyNode |
transformGraph(org.eclipse.aether.graph.DependencyNode node,
org.eclipse.aether.collection.DependencyGraphTransformationContext context) |
public org.eclipse.aether.graph.DependencyNode transformGraph(org.eclipse.aether.graph.DependencyNode node,
org.eclipse.aether.collection.DependencyGraphTransformationContext context)
throws org.eclipse.aether.RepositoryException
transformGraph in interface org.eclipse.aether.collection.DependencyGraphTransformerorg.eclipse.aether.RepositoryExceptionCopyright © 2024 MuleSoft, Inc.. All rights reserved.