views:

868

answers:

4

I want to generate javadocs through maven's site generation plugin and I want to have automatic UML diagrams created and embedded in the javadoc.

The statsvn project uses yDoc to generate their UML documentation but I think they're using Maven1. yDoc is a commercial shareware product, so I'm unsure how the open source statsvn project integrates with it (or if there is a free version to use for javadoc generation).

Example svnstat yDoc javadoc: ChurnPageMaker.java

svnstat includes ydoc as a plugin to their Maven1 report generation: project.xml

    <reports>
            <report>maven-ydoc-plugin</report>
 ...
    </reports>

The yDoc documentation says you can use Maven2's custom javadoc doclet approach (but I can't figure out where to download yDoc or if it's free). It seems like the statsvn project is using yDoc so I'm guessing it's free?

Are there any other open source Javadoc doclet generators that integrate with Maven2 to generate javadocs with embedded class diagrams.

A: 

I know you want java docs, but have you checked out Doxygen? Perhaps it can do what you want. Here's a question comparing Javadocs and Doxygen.

Jorge Israel Peña
+1  A: 

It looks like the APIViz doclet support Maven2 javadoc plugin to generate class diagrams in javadoc.

  <reporting>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <doclet>org.jboss.apiviz.APIviz</doclet>
          <docletArtifact>
            <groupId>org.jboss.apiviz</groupId>
            <artifactId>apiviz</artifactId>
            <version>1.3.0.GA</version>
          </docletArtifact>
          <useStandardDocletOptions>true</useStandardDocletOptions>
          <charset>UTF-8</charset>
          <encoding>UTF-8</encoding>
          <docencoding>UTF-8</docencoding>
          <breakiterator>true</breakiterator>
          <version>true</version>
          <author>true</author>
          <keywords>true</keywords>
          <additionalparam>
            -sourceclasspath ${project.build.outputDirectory}
          </additionalparam>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </reporting>
Dougnukem
+1  A: 

For Maven 2, have a look at http://maven.apache.org/plugins/maven-javadoc-plugin/examples/alternate-doclet.html which describes how to include UmlGraph diagrams in the javadoc of your code (requires Graphviz binary on the PATH). Below a sample POM using UmlGraph as alternate doclet:

<project>
  ...
  <reporting> (or <build>)
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.6.1</version>
        <configuration>
          <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
          <!-- <docletPath>/path/to/UmlGraph.jar</docletPath> -->
          <docletArtifact>
            <groupId>org.umlgraph</groupId>
            <artifactId>doclet</artifactId>
            <version>5.1</version>
          </docletArtifact>
          <additionalparam>-views</additionalparam>
          <useStandardDocletOptions>true</useStandardDocletOptions>
        </configuration>
      </plugin>
    ...
    </plugins>
  </reporting> (or </build>)
  ...
</project>
Pascal Thivent
A: 

See http://www.reversejava.com for a dynamic reverse engineering application which generates UML Sequence diagram and view of Participating Class diagram from any Java Application at runtime All you have to do is just run your application and sit back. Reverse Java runs in background tracing all the activities happening inside your application and creates UML diagram for you.

You also have options for, excluding packages,editing the Sequence diagram and exporting the diagrams as PDF or Image.

And its not expensive !

Rajesh Jadhav