Monday Sep 01, 2008

Generate UML Diagrams into Javadoc for NetBeans Module Projects

Here's Javadoc with UML diagrams for the Google Toolbar module from the NetBeans Plugin Quick Start:

To let the IDE automatically generate UML diagrams into your NetBeans module's Javadoc, do this:

  1. Read this for background and to set up the required software.

  2. Add this to the module project's build.xml file:
    <target name="netbeans-extra" description="Generates UML-Javadoc">
        <property file="nbproject/project.properties"/>
        <mkdir dir="${dist.javadoc.dir}"/>
        <javadoc source="${javac.source}" packagenames="org.\*" 
              destdir="${dist.javadoc.dir}"  
              private="true">
            <classpath>
                <path path="${javac.classpath}"/>
                <path path="${module.classpath}"/>
            </classpath>
            <fileset dir="${src.dir}" excludes="${excludes}" 
              includes="${includes}">
                <filename name="\*\*/\*.java"/>
            </fileset>
            <doclet name="org.umlgraph.doclet.UmlGraphDoc" 
              path="${file.reference.UmlGraph.jar}">
                <param name="-attributes" />
                <param name="-operations" />
                <param name="-qualify" />
                <param name="-types" />
                <param name="-visibility" />
            </doclet>
        </javadoc>
    </target>

  3. Put UmlGraph.jar in release/modules/ext (or anywhere else, as long as the reference in project.properties for ${file.reference.UmlGraph.jar} is correct).

  4. Copy the content of a standard NetBeans Java project's project.properties file into your module project's project.properties file.

Now build the module and then look in the Files window, within dist/javadoc and you should find your HTML files have UML diagrams.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« September 2008 »
SunMonTueWedThuFriSat
 
3
6
9
13
14
23
30
    
       
Today