Class TreeMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.dependency.tree.TreeMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="tree", requiresDependencyCollection=TEST, threadSafe=true) public class TreeMojo extends org.apache.maven.plugin.AbstractMojoDisplays the dependency tree for this project. Multiple formats are supported: text (by default), but also DOT, GraphML, TGF and JSON.- Since:
- 2.0-alpha-5
-
-
Field Summary
Fields Modifier and Type Field Description private booleanappendOutputWhether to append outputs into the output file or overwrite it.private org.apache.maven.shared.dependency.graph.DependencyCollectorBuilderdependencyCollectorBuilderThe dependency collector builder to use.private org.apache.maven.shared.dependency.graph.DependencyGraphBuilderdependencyGraphBuilderThe dependency graph builder to use.private java.util.List<java.lang.String>excludesA comma-separated list of artifacts to filter from the serialized dependency tree, ornullnot to filter any artifacts from the dependency tree.private java.util.List<java.lang.String>includesA comma-separated list of artifacts to filter the serialized dependency tree by, ornullnot to filter the dependency tree.private java.lang.StringoutputEncodingprivate java.io.FileoutputFileIf specified, this parameter will cause the dependency tree to be written to the path specified, instead of writing to the console.private java.lang.StringoutputTypeIf specified, this parameter will cause the dependency tree to be written using the specified format.private org.apache.maven.project.MavenProjectprojectThe Maven project.private org.apache.maven.shared.dependency.graph.DependencyNoderootNodeThe computed dependency tree root node of the Maven project.private java.lang.StringscopeThe scope to filter by when resolving the dependency tree, ornullto include dependencies from all scopes.private org.apache.maven.execution.MavenSessionsessionprivate booleanskipSkip plugin execution completely.private java.lang.StringtokensThe token set name to use when outputting the dependency tree.private booleanverboseWhether to include omitted nodes in the serialized dependency tree.
-
Constructor Summary
Constructors Constructor Description TreeMojo(org.apache.maven.project.MavenProject project, org.apache.maven.execution.MavenSession session, org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder dependencyCollectorBuilder, org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.apache.maven.shared.dependency.graph.filter.DependencyNodeFiltercreateDependencyNodeFilter()Gets the dependency node filter to use when serializing the dependency graph.private org.apache.maven.artifact.resolver.filter.ArtifactFiltercreateResolvingArtifactFilter()Gets the artifact filter to use when resolving the dependency tree.voidexecute()org.apache.maven.shared.dependency.graph.DependencyNodegetDependencyGraph()Gets the computed dependency graph root node for the Maven project.org.apache.maven.project.MavenProjectgetProject()Gets the Maven project used by this mojo.org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitorgetSerializingDependencyNodeVisitor(java.io.Writer writer)booleanisSkip()private java.lang.StringserializeDependencyTree(org.apache.maven.shared.dependency.graph.DependencyNode theRootNode)Serializes the specified dependency tree to a string.voidsetSkip(boolean skip)private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokenstoGraphTokens(java.lang.String theTokens)Gets the graph tokens instance for the specified name.
-
-
-
Field Detail
-
project
private final org.apache.maven.project.MavenProject project
The Maven project.
-
session
private final org.apache.maven.execution.MavenSession session
-
dependencyCollectorBuilder
private final org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder dependencyCollectorBuilder
The dependency collector builder to use.
-
dependencyGraphBuilder
private final org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilder
The dependency graph builder to use.
-
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}") private java.lang.String outputEncoding
-
outputFile
@Parameter(property="outputFile") private java.io.File outputFile
If specified, this parameter will cause the dependency tree to be written to the path specified, instead of writing to the console.- Since:
- 2.0-alpha-5
-
outputType
@Parameter(property="outputType", defaultValue="text") private java.lang.String outputTypeIf specified, this parameter will cause the dependency tree to be written using the specified format. Currently supported formats are:text(default),dot,graphml,tgfandjson(since 3.7.0). These additional formats can be plotted to image files.- Since:
- 2.2
-
scope
@Parameter(property="scope") private java.lang.String scope
The scope to filter by when resolving the dependency tree, ornullto include dependencies from all scopes.- Since:
- 2.0-alpha-5
-
verbose
@Parameter(property="verbose", defaultValue="false") private boolean verboseWhether to include omitted nodes in the serialized dependency tree.- Since:
- 2.0-alpha-6
-
tokens
@Parameter(property="tokens", defaultValue="standard") private java.lang.String tokensThe token set name to use when outputting the dependency tree. Possible values arewhitespace,standardorextended, which use whitespace, standard (ie ASCII) or extended character sets respectively.- Since:
- 2.0-alpha-6
-
includes
@Parameter(property="includes") private java.util.List<java.lang.String> includes
A comma-separated list of artifacts to filter the serialized dependency tree by, ornullnot to filter the dependency tree. The filter syntax is:[groupId]:[artifactId]:[type]:[version]
where each pattern segment is optional and supports full and partial*wildcards. An empty pattern segment is treated as an implicit wildcard.For example,
org.apache.*will match all artifacts whose group id starts withorg.apache., and:::*-SNAPSHOTwill match all snapshot artifacts.- Since:
- 2.0-alpha-6
- See Also:
StrictPatternIncludesArtifactFilter
-
excludes
@Parameter(property="excludes") private java.util.List<java.lang.String> excludes
A comma-separated list of artifacts to filter from the serialized dependency tree, ornullnot to filter any artifacts from the dependency tree. The filter syntax is:[groupId]:[artifactId]:[type]:[version]
where each pattern segment is optional and supports full and partial*wildcards. An empty pattern segment is treated as an implicit wildcard.For example,
org.apache.*will match all artifacts whose group id starts withorg.apache., and:::*-SNAPSHOTwill match all snapshot artifacts.- Since:
- 2.0-alpha-6
- See Also:
StrictPatternExcludesArtifactFilter
-
rootNode
private org.apache.maven.shared.dependency.graph.DependencyNode rootNode
The computed dependency tree root node of the Maven project.
-
appendOutput
@Parameter(property="appendOutput", defaultValue="false") private boolean appendOutputWhether to append outputs into the output file or overwrite it.- Since:
- 2.2
-
skip
@Parameter(property="skip", defaultValue="false") private boolean skipSkip plugin execution completely.- Since:
- 2.7
-
-
Constructor Detail
-
TreeMojo
@Inject public TreeMojo(org.apache.maven.project.MavenProject project, org.apache.maven.execution.MavenSession session, org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder dependencyCollectorBuilder, org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilder)
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getProject
public org.apache.maven.project.MavenProject getProject()
Gets the Maven project used by this mojo.- Returns:
- the Maven project
-
getDependencyGraph
public org.apache.maven.shared.dependency.graph.DependencyNode getDependencyGraph()
Gets the computed dependency graph root node for the Maven project.- Returns:
- the dependency tree root node
-
isSkip
public boolean isSkip()
- Returns:
skip
-
setSkip
public void setSkip(boolean skip)
- Parameters:
skip-skip
-
createResolvingArtifactFilter
private org.apache.maven.artifact.resolver.filter.ArtifactFilter createResolvingArtifactFilter()
Gets the artifact filter to use when resolving the dependency tree.- Returns:
- the artifact filter
-
serializeDependencyTree
private java.lang.String serializeDependencyTree(org.apache.maven.shared.dependency.graph.DependencyNode theRootNode)
Serializes the specified dependency tree to a string.- Parameters:
theRootNode- the dependency tree root node to serialize- Returns:
- the serialized dependency tree
-
getSerializingDependencyNodeVisitor
public org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor getSerializingDependencyNodeVisitor(java.io.Writer writer)
- Parameters:
writer-Writer- Returns:
DependencyNodeVisitor
-
toGraphTokens
private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokens toGraphTokens(java.lang.String theTokens)
Gets the graph tokens instance for the specified name.- Parameters:
theTokens- the graph tokens name- Returns:
- the
GraphTokensinstance
-
createDependencyNodeFilter
private org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter createDependencyNodeFilter()
Gets the dependency node filter to use when serializing the dependency graph.- Returns:
- the dependency node filter, or
nullif none required
-
-