HomePage | RecentChanges | Preferences

Using UMLGraph and Maven 2

UmlGraph v4.6

UMLGraph 4.6 is the latest version. You can see examples of configuration and output here:

UmlGraph v4.4

UMLGraph v4.4 is [available on]. It includes an alternate doclet for the Javadoc tool that will generate UML diagrams as part of the Javadoc creation.

Note: You must have the Graphviz 'dot' binary on your PATH, or the images will not be generated.

I'm using Tiles 2 to test this...

svn co

So, update the Tiles 2 pom:

$ svn diff
Index: pom.xml
--- pom.xml     (revision 425394)
+++ pom.xml     (working copy)
@@ -136,6 +136,23 @@
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <doclet>gr.spinellis.umlgraph.doclet.UmlGraphDoc</doclet>
+                    <docletArtifact>
+                        <groupId>gr.spinellis</groupId>
+                        <artifactId>UmlGraph</artifactId>
+                        <version>4.4</version>
+                    </docletArtifact>
+                    <additionalparam>
+                        -inferrel -inferdep -quiet -hide java.* -collpackages java.util.* -qualify
+                        -postfixpackage -nodefontsize 9
+                        -nodefontpackagesize 7
+                    </additionalparam>
+                </configuration>
+            </plugin>

Then 'mvn site' will build the site, including Javadoc with UML diagrams at the class and package level.

You can see UmlGraphDoc? in action in the Tiles 2 Javadoc, [here].


UmlGraph v4.3

Install UmlGraph.jar into your local Maven 2 repository:

$ mvn install:install-file  -Dpackaging=jar 
(all on one line)

With Maven 2, to run the UMLGraph doclet in addition to the normal HTML Javadoc doclet, configure the following section in your pom.




The above configuration will generate ".dot" files. An additional step is necessary to convert these into images.
See the UMLGraph documentation for information on using GraphViz to convert the .dot files to images.
[This thread] has some code that may be useful for doing the conversion with Maven 2.

Note: To run the UMLGraph doclet instead of the usual HTML Javadoc doclet, move the configuration of the plugin from the <reporting> section to the <build> section.

Note: The patch for [MJAVADOC-46] was accepted, so with maven-javadoc-plugin 2.0, it is possible to configure a <docletArtifact> instead of a <docletPath>:

Note: If you have trouble with the Maven Javadoc Plugin, try building it from source:

     $ svn co
     $ cd maven-javadoc-plugin
     $ mvn install

See also: [Maven/Javadoc]

If you have any questions about using UMLGraph with Maven, please ask on the [mailing list].

UMLGraph 4.2 snapshot

Andrea Aime posted a [message] to commons-dev offering automatically generated UML diagrams for DBCP. Since the UML diagrams for Struts Action are labeled "1.1" and dated 2003, I was interested! The library is [UMLGraph] in conjunction with [Graphviz].

After a bit of initial trouble, (the linked examples were done with a snapshot of UMLGraph 4.2,) I got version 4.1 to generate some package level diagrams. Once Andrea provided a link to a nightly build of version 4.2 and answered some questions, I was able to produce a "view" of some classes in the org.apache.shale.dialog package:

More diagrams, plus the and build-uml.xml files:



POM for Upload

<?xml version="1.0"?>
<project xmlns=""

   <name>UML Graph</name>
   <description>Declarative Drawing of UML Diagrams</description>
         <name>BSD License (original)</name>



HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited October 28, 2008 7:05 am by WendySmoak (diff)