org.universAAL.maven.treebuilder
Class DependencyTreeBuilder
java.lang.Object
org.universAAL.maven.treebuilder.DependencyTreeBuilder
public class DependencyTreeBuilder
- extends Object
Class builds one big dependency tree for given list of artifacts. Each
artifact in the list is treated as a rootnode of a separate tree. All
duplicates and conflicts are detected throughout the big tree. The tree
contains not only regular maven dependencies but also runtime dependencies
which are extracted from "uAAL-Runtime" profile of each pom. Artifacts of the
following scopes are included in the tree:
regular maven dependencies: compile and runtime
maven dependencies from "uAAL-Runtime" profile: compile, runtime and
provided
Class code was based on the implementation of class
org.apache.maven.shared.dependency.tree.DefaultDependencyTreeBuilder present
in maven-dependency-tree-1.1.jar and the implementation of class
org.apache.maven.artifact.resolver.DefaultArtifactCollector present in
maven-artifact-2.2.1.jar. Both classes are licensed under Apache License,
Version 2.0.
- Author:
- rotgier
Constructor Summary |
DependencyTreeBuilder(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
boolean includeTestRuntimes)
Creates instance of DependencyTreeBuilder with needed parameters. |
Method Summary |
List<RootNode> |
buildDependencyTree(org.apache.maven.artifact.repository.ArtifactRepository repository,
org.apache.maven.artifact.factory.ArtifactFactory factory,
org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource,
MavenProjectDescriptor... projectDescs)
Method builds dependency tree for a list of maven projects. |
List<org.apache.maven.artifact.resolver.ResolutionNode> |
getSeparatedArtifactDepsOfRoot()
Getter method to separatedArtifactDepsOfRoot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UAAL_RUNTIME_PROFILE
public static final String UAAL_RUNTIME_PROFILE
- See Also:
- Constant Field Values
UAAL_TEST_RUNTIME_PROFILE
public static final String UAAL_TEST_RUNTIME_PROFILE
- See Also:
- Constant Field Values
PROP_SEPARATED_GROUP_IDS
public static final String PROP_SEPARATED_GROUP_IDS
- See Also:
- Constant Field Values
DependencyTreeBuilder
public DependencyTreeBuilder(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
boolean includeTestRuntimes)
- Creates instance of DependencyTreeBuilder with needed parameters.
- Parameters:
artifactFactory
- ArtifactFactory object provided by maven.mavenProjectBuilder
- MavenProjectBuilder object provided by maven.localRepository
- The maven's local b provided by maven.includeTestRuntimes
- Indication whether artifacts for test runtime profile should
be also generated.
buildDependencyTree
public List<RootNode> buildDependencyTree(org.apache.maven.artifact.repository.ArtifactRepository repository,
org.apache.maven.artifact.factory.ArtifactFactory factory,
org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource,
MavenProjectDescriptor... projectDescs)
throws org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException,
org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException,
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException,
SecurityException,
NoSuchFieldException,
IllegalArgumentException,
IllegalAccessException
- Method builds dependency tree for a list of maven projects. All artifacts
in the tree are crosschecked against duplications and conflicts. In each
case of duplication, conflict, the case is resolved by omitting artifact
which is lower in the tree and keeping artifact which is higher in the
tree. If artifacts are on the same level then the one occuring first in
the tree is kept.
- Parameters:
repository
- Maven repository.factory
- Factory used for creating artifacts.metadataSource
- ArtifactMetadataSource provided by maven.projectDescs
- list of maven project descriptors. Each descriptor contains
MavenProject, a list of project's remote repositories and a
boolean indicator if the project needs to be resolved
transitively or not.
- Returns:
- a dependency tree as a list of rootnodes (instances of
DependencyNode class) which contain their own subtrees. Each
rootnode corresponds to one maven project provided as argument.
The order of rootnodes list is the same as order of provided
maven projects list.
- Throws:
org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException
- Notifies about a problem during building the dependency tree.
org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
- Signals problem with metadata retieval.
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
- Informs about invalid version specifications.
NoSuchFieldException
- Exception related to reflection.
SecurityException
- Exception thrown by security manager.
IllegalAccessException
- Illegal access during usage of java reflection.
IllegalArgumentException
- Illegal argument was passed.
getSeparatedArtifactDepsOfRoot
public List<org.apache.maven.artifact.resolver.ResolutionNode> getSeparatedArtifactDepsOfRoot()
- Getter method to separatedArtifactDepsOfRoot.
- Returns:
- Returns list of separatedArtifactDepsOfRoot.
Copyright © 2014 universAAL Consortium. All Rights Reserved.