The Holy Java

Building the right thing, building it right, fast

Visualize Maven Project Dependencies with dependency:tree and Dot Diagram Output

Posted by Jakub Holý on January 13, 2012

The dependency:tree goal of the Maven plugin dependency supports various graphical outputs from the version 2.4 up. This is how you would create a diagram showing all dependencies in the com.example group in the dot format:

mvn dependency:tree -Dincludes=com.example -DappendOutput=true -DoutputType=dot -DoutputFile=/path/to/output.gv

(The output is just a text file with the extension Graphviz gv.)

To actually produce an image from the dot file you can use one of dot renderers, f.ex. this online dot renderer (paste into the right text box, press enter).

You could also generate the output f.ex. in the graphml format & visualize it in Eclipse.

Note: Thanks to the reader Not Relevant for pointing out the right extension and a typo.

About these ads

4 Responses to “Visualize Maven Project Dependencies with dependency:tree and Dot Diagram Output”

  1. Not Relevant said

    … and the “.gv” extension is better! gv=Graphviz

  2. Plaz said

    Hi, I’m very new to maven, so I’m sorry for the stupid question. How I can install dependency-plugin? I’ve tried: mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:resolve-plugins , but build failed on:

    Embedded error: Unable to determine the release version

    Try downloading the file manually from the project website.

Sorry, the comment form is closed at this time.

 
%d bloggers like this: