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.AbstractMojo
Displays 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
FieldsModifier and TypeFieldDescriptionprivate boolean
Whether to append outputs into the output file or overwrite it.private org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder
The dependency collector builder to use.private org.apache.maven.shared.dependency.graph.DependencyGraphBuilder
The dependency graph builder to use.A comma-separated list of artifacts to filter from the serialized dependency tree, ornull
not to filter any artifacts from the dependency tree.A comma-separated list of artifacts to filter the serialized dependency tree by, ornull
not to filter the dependency tree.private String
private File
If specified, this parameter will cause the dependency tree to be written to the path specified, instead of writing to the console.private String
If specified, this parameter will cause the dependency tree to be written using the specified format.private org.apache.maven.project.MavenProject
The Maven project.private org.apache.maven.shared.dependency.graph.DependencyNode
The computed dependency tree root node of the Maven project.private String
The scope to filter by when resolving the dependency tree, ornull
to include dependencies from all scopes.private org.apache.maven.execution.MavenSession
private boolean
Skip plugin execution completely.private String
The token set name to use when outputting the dependency tree.private boolean
Whether to include omitted nodes in the serialized dependency tree.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter
Gets the dependency node filter to use when serializing the dependency graph.private org.apache.maven.artifact.resolver.filter.ArtifactFilter
Gets the artifact filter to use when resolving the dependency tree.void
execute()
org.apache.maven.shared.dependency.graph.DependencyNode
Gets the computed dependency graph root node for the Maven project.org.apache.maven.project.MavenProject
Gets the Maven project used by this mojo.org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor
boolean
isSkip()
private String
serializeDependencyTree
(org.apache.maven.shared.dependency.graph.DependencyNode theRootNode) Serializes the specified dependency tree to a string.void
setSkip
(boolean skip) private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokens
toGraphTokens
(String theTokens) Gets the graph tokens instance for the specified name.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
project
@Component private org.apache.maven.project.MavenProject projectThe Maven project. -
session
@Component private org.apache.maven.execution.MavenSession session -
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}") private String outputEncoding -
dependencyCollectorBuilder
@Component(hint="default") private org.apache.maven.shared.dependency.graph.DependencyCollectorBuilder dependencyCollectorBuilderThe dependency collector builder to use. -
dependencyGraphBuilder
@Component(hint="default") private org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilderThe dependency graph builder to use. -
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
If specified, this parameter will cause the dependency tree to be written using the specified format. Currently supported formats are:text
(default),dot
,graphml
,tgf
andjson
. These additional formats can be plotted to image files.- Since:
- 2.2
-
scope
The scope to filter by when resolving the dependency tree, ornull
to 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
The token set name to use when outputting the dependency tree. Possible values arewhitespace
,standard
orextended
, which use whitespace, standard (ie ASCII) or extended character sets respectively.- Since:
- 2.0-alpha-6
-
includes
A comma-separated list of artifacts to filter the serialized dependency tree by, ornull
not 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:::*-SNAPSHOT
will match all snapshot artifacts.- Since:
- 2.0-alpha-6
- See Also:
-
excludes
A comma-separated list of artifacts to filter from the serialized dependency tree, ornull
not 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:::*-SNAPSHOT
will match all snapshot artifacts.- Since:
- 2.0-alpha-6
- See Also:
-
rootNode
private org.apache.maven.shared.dependency.graph.DependencyNode rootNodeThe 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 Details
-
TreeMojo
public TreeMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.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
-
getSerializingDependencyNodeVisitor
public org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor getSerializingDependencyNodeVisitor(Writer writer) - Parameters:
writer
-Writer
- Returns:
DependencyNodeVisitor
-
toGraphTokens
private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokens toGraphTokens(String theTokens) Gets the graph tokens instance for the specified name.- Parameters:
theTokens
- the graph tokens name- Returns:
- the
GraphTokens
instance
-
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
null
if none required
-