[Home]UMLGraph

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 ibiblio.com]. 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 https://svn.apache.org/repos/asf/struts/sandbox/trunk/tiles

So, update the Tiles 2 pom:

~/svn/struts/current/sandbox/tiles
$ svn diff
Index: pom.xml
===================================================================
--- pom.xml     (revision 425394)
+++ pom.xml     (working copy)
@@ -136,6 +136,23 @@
             <plugin>
                 <artifactId>maven-pmd-plugin</artifactId>
             </plugin>
+            <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>
         </plugins>
     </reporting>

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].

Changes

UmlGraph v4.3

Install UmlGraph.jar into your local Maven 2 repository:

$ mvn install:install-file  -Dpackaging=jar 
                            -DartifactId=UmlGraph 
                            -Dversion=4.3 
                            -Dfile=/path/to/UmlGraph.jar 
                            -DgroupId=gr.spinellis 
                            -DgeneratePom=true
(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.

 
<project>
...
   <reporting>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <reportSets>
               <reportSet>
                  <id>uml</id>
                  <configuration>
                     <doclet>gr.spinellis.umlgraph.doclet.UmlGraph</doclet>

                     <!--docletPath>/path/to/UmlGraph.jar</docletPath-->
                     <docletArtifact>
                        <groupId>gr.spinellis</groupId>
                        <artifactId>UmlGraph</artifactId>
                        <version>4.3</version>
                     </docletArtifact>

                     <additionalparam>-views</additionalparam>
                     <destDir>target/uml</destDir>
                     <show>private</show>
                  </configuration>
                  <reports>
                     <report>javadoc</report>
                  </reports>
               </reportSet>
               <reportSet>
                  <id>html</id>
                  <configuration>
                     <show>private</show>
                  </configuration>
                  <reports>
                     <report>javadoc</report>
                  </reports>
               </reportSet>
            </reportSets>
         </plugin>
      ...
      </plugins>
   </reporting>
...
</project>

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 http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-javadoc-plugin
     $ cd maven-javadoc-plugin
     $ mvn install

See also: [Maven/Javadoc]

If you have any questions about using UMLGraph with Maven, please ask on the users@maven.apache.org [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 UmlGraphConfig.java and build-uml.xml files:

TODO

References

POM for Upload

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

   <modelVersion>4.0.0</modelVersion>
   <groupId>gr.spinellis</groupId>
   <artifactId>UmlGraph</artifactId>
   <version>4.3</version>
   <packaging>jar</packaging>
   <name>UML Graph</name>
   <url>http://www.spinellis.gr/sw/umlgraph/</url>
   <description>Declarative Drawing of UML Diagrams</description>
   <licenses>
      <license>
         <name>BSD License (original)</name>
         <url>http://www.opensource.org/licenses/bsd-license.php</url>
         <distribution>repo</distribution>
      </license>
   </licenses>

   <dependencies/>

</project>

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