@Mojo(name="tree",
requiresDependencyCollection=TEST,
threadSafe=true)
public class TreeMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
private boolean |
appendOutput
Whether to append outputs into the output file or overwrite it.
|
private org.apache.maven.shared.dependency.graph.DependencyGraphBuilder |
dependencyGraphBuilder
The dependency tree builder to use.
|
private java.lang.String |
excludes
A comma-separated list of artifacts to filter from the serialized dependency tree, or
null not to
filter any artifacts from the dependency tree. |
private java.lang.String |
includes
A comma-separated list of artifacts to filter the serialized dependency tree by, or
null not to
filter the dependency tree. |
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.
|
private java.lang.String |
outputType
If specified, this parameter will cause the dependency tree to be written using the specified format.
|
private org.apache.maven.project.MavenProject |
project
The Maven project.
|
private java.util.List<org.apache.maven.project.MavenProject> |
reactorProjects
Contains the full list of projects in the reactor.
|
private org.apache.maven.shared.dependency.graph.DependencyNode |
rootNode
The computed dependency tree root node of the Maven project.
|
private java.lang.String |
scope
The scope to filter by when resolving the dependency tree, or
null to include dependencies from all
scopes. |
private org.apache.maven.execution.MavenSession |
session |
private boolean |
skip
Skip plugin execution completely.
|
private java.lang.String |
tokens
The token set name to use when outputting the dependency tree.
|
private boolean |
verbose
Whether to include omitted nodes in the serialized dependency tree.
|
Constructor and Description |
---|
TreeMojo() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange,
org.apache.maven.artifact.versioning.ArtifactVersion theVersion)
Copied from Artifact.VersionRange.
|
private org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter |
createDependencyNodeFilter()
Gets the dependency node filter to use when serializing the dependency graph.
|
private org.apache.maven.artifact.resolver.filter.ArtifactFilter |
createResolvingArtifactFilter()
Gets the artifact filter to use when resolving the dependency tree.
|
void |
execute() |
org.apache.maven.shared.dependency.graph.DependencyNode |
getDependencyGraph()
Gets the computed dependency graph root node for the Maven project.
|
org.apache.maven.project.MavenProject |
getProject()
Gets the Maven project used by this mojo.
|
org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor |
getSerializingDependencyNodeVisitor(java.io.Writer writer) |
boolean |
isSkip() |
private java.lang.String |
serializeDependencyTree(org.apache.maven.shared.dependency.graph.DependencyNode rootNode)
Serializes the specified dependency tree to a string.
|
void |
setSkip(boolean skip) |
private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokens |
toGraphTokens(java.lang.String tokens)
Gets the graph tokens instance for the specified name.
|
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${reactorProjects}", readonly=true, required=true) private java.util.List<org.apache.maven.project.MavenProject> reactorProjects
@Component(hint="default") private org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyGraphBuilder
@Parameter(property="outputFile") private java.io.File outputFile
@Parameter(property="outputType", defaultValue="text") private java.lang.String outputType
text
, dot
, graphml
and tgf
.
These formats can be plotted to image files. An example of how to plot a dot file using pygraphviz can be found
here.@Parameter(property="scope") private java.lang.String scope
null
to include dependencies from all
scopes. Note that this feature does not currently work due to MSHARED-4@Parameter(property="verbose", defaultValue="false") private boolean verbose
@Parameter(property="tokens", defaultValue="standard") private java.lang.String tokens
whitespace
,
standard
or extended
, which use whitespace, standard (ie ASCII) or extended character
sets respectively.@Parameter(property="includes") private java.lang.String includes
null
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 with
org.apache.
, and :::*-SNAPSHOT
will match all snapshot artifacts.
StrictPatternIncludesArtifactFilter
@Parameter(property="excludes") private java.lang.String excludes
null
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 with
org.apache.
, and :::*-SNAPSHOT
will match all snapshot artifacts.
StrictPatternExcludesArtifactFilter
private org.apache.maven.shared.dependency.graph.DependencyNode rootNode
@Parameter(property="appendOutput", defaultValue="false") private boolean appendOutput
@Parameter(property="skip", defaultValue="false") private boolean skip
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
public org.apache.maven.project.MavenProject getProject()
public org.apache.maven.shared.dependency.graph.DependencyNode getDependencyGraph()
public boolean isSkip()
public void setSkip(boolean skip)
private org.apache.maven.artifact.resolver.filter.ArtifactFilter createResolvingArtifactFilter()
private java.lang.String serializeDependencyTree(org.apache.maven.shared.dependency.graph.DependencyNode rootNode)
rootNode
- the dependency tree root node to serializepublic org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor getSerializingDependencyNodeVisitor(java.io.Writer writer)
private org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor.GraphTokens toGraphTokens(java.lang.String tokens)
tokens
- the graph tokens nameGraphTokens
instanceprivate org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter createDependencyNodeFilter()
null
if none requiredpublic static boolean containsVersion(org.apache.maven.artifact.versioning.VersionRange allowedRange, org.apache.maven.artifact.versioning.ArtifactVersion theVersion)
allowedRange
- range of allowed versions.theVersion
- the version to be checked.