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.


Not Relevant said
… and the “.gv” extension is better! gv=Graphviz
Jakub Holý said
Thx for the fixes!
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.
Jakub Holý said
Hi Plaz, you should not need to install anything. I believe that Maven should find it itself. (I am using Maven 3, if that makes a difference.)