Class 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 and TGF.
    Since:
    2.0-alpha-5
    Author:
    Mark Hobson
    • Constructor Detail

      • TreeMojo

        public TreeMojo()
    • Method Detail

      • 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
      • getSerializingDependencyNodeVisitor

        public org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor getSerializingDependencyNodeVisitor​(Writer writer)
        Parameters:
        writer - Writer
        Returns:
        DependencyNodeVisitor
      • containsVersion

        public static boolean containsVersion​(org.apache.maven.artifact.versioning.VersionRange allowedRange,
                                              org.apache.maven.artifact.versioning.ArtifactVersion theVersion)
        Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" == "[2.0.4,)"
        Parameters:
        allowedRange - range of allowed versions.
        theVersion - the version to be checked.
        Returns:
        true if the version is contained by the range.