Download NetBeans!

20080901 Monday September 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.

Sep 01 2008, 11:01:31 AM PDT Permalink