Skip to main content

Enhance your javadoc with ULMGraph

Posted by survivant on December 26, 2009 at 3:38 PM PST

We can't live without Javadoc, but even if it useful, it's not complete. One missing thing is UML within the Javadoc.

To add UML to your Javadoc, is quite simple. You need to add Graphviz into your maven build.

First you need to download and install Graphviz. Go there Graphviz

After that you should add the variable GRAPHVIZ_HOME (that point to the installation folder) into your system.

The last step is to add the plugin into your pom.

Add the lines in bold.

    <detectOfflineLinks />
      use this line or use the variable GRAPHVIZ_HOME


With that you will have nice UML into your javadoc. I hope that help.


An alternative without installing Graphviz locally

                            &lt;/links&gt;          &lt;source&gt;1.6&lt;/source&gt;
                    -inferrel -inferdep -quiet -hide java.*
                    -collpackages java.util.* -qualify
                    -postfixpackage -nodefontsize 9
                    -nodefontpackagesize 7

It will use Graphviz, but it will download it from the web instead of forcing the local installation.. :)



I tried it before but it didn't work for unknown reason.  I'll switch to your way.  I prefer that.



How to use Graphviz on non-Maven projects ?

Hi I'd like to have UML on my Javadocs, but had no plans to use Maven. Any ideas ?

Never try and didn't look for

Never try and didn't look for that.  I know there are plugin to ant to launch maven task.  Maybe you can use that.


This immediately went onto my project. Thanks for the tip, both of you.