Jakub is a Java EE developer since 2005 and occasionally a project manager, working currently with Iterate AS. He's highly interested in developer productivity (and tools like Maven and AOP/AspectJ), web frameworks, Java portals, testing and performance and works a lot with IBM technologies. A native to Czech Republic, he lives now in Oslo, Norway. Jakub is a DZone MVB and is not an employee of DZone and has posted 156 posts at DZone. You can read more from them at their website. View Full User Profile

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

  • submit to reddit

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 -DappendOutput=true -DoutputFile=/path/to/output.dot

To actually produce an image from .dot 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.


From http://theholyjava.wordpress.com/2012/01/13/visualize-maven-project-dependencies-with-dependencytree-and-dot-diagram-output/

Published at DZone with permission of Jakub Holý, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


matt inger replied on Mon, 2012/01/30 - 4:00pm

Thanks. Just a note, after trying this, it seems that maven 3.0.x is tied to version 2.1 by default, so you will need to specify 2.4 explicitly:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:tree -DoutputType=dot

Also note that the documentation for this plugin incorrectly states that the outputType property is available from 2.1 on. It should say 2.4.

Kirill Kulikov replied on Wed, 2013/08/28 - 4:34am in response to: matt inger

Thank you! That's really helpful!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.