Enhance your javadoc with ULMGraph
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.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
<detectOfflineLinks />
<b> <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
<!--
use this line or use the variable GRAPHVIZ_HOME
<docletPath>/path/to/UmlGraph.jar</docletPath>
-->
<docletArtifact>
<groupId>org.umlgraph</groupId>
<artifactId>doclet</artifactId>
<version>5.1</version>
</docletArtifact>
</b>
<additionalparam>-operations</additionalparam>
<additionalparam>-qualify</additionalparam>
<additionalparam>-types</additionalparam>
<additionalparam>-visibility</additionalparam>
<additionalparam>-collpackages</additionalparam>
<show>private</show>
</configuration>
</plugin>
With that you will have nice UML into your javadoc. I hope that help.
- Login or register to post comments
- Printer-friendly version
- survivant's blog
- 2960 reads






Comments
An alternative without installing Graphviz locally
by felipegaucho - 2009-12-27 00:59
It will use Graphviz, but it will download it from the web instead of forcing the local installation.. :)
thanks.
by survivant - 2009-12-30 08:21
thanks.
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 ?
by zesharp - 2010-01-05 05:56
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
by survivant - 2010-01-06 16:14
Never try and didn't look for that. I know there are plugin to ant to launch maven task. Maybe you can use that.
Fantastic!
by aberrant - 2009-12-28 12:53
This immediately went onto my project. Thanks for the tip, both of you.