Blog

  • 2024
  • 2023
  • 2022
  • 2021
  • 2020
  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012




There are a couple of tools that allow to produce appealing API documentation with Javadoc.

UMLGraph is one of them.

Using UMLGraph

The Doclet allows to render UML diagrams automatically in Javadoc reports like this:

This gives a good overview over the relationships of the highlighted class. It also allows navigating to another class by clicking on it.

 

Maven Configuration

To integrate this in your Maven build, use this configuration for the Maven Javadoc Plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <configuration>
    ...
    <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
    <docletArtifact>
      <groupId>org.umlgraph</groupId>
      <artifactId>UmlGraph</artifactId>
      <version>5.6</version>
    </docletArtifact>
    <additionalparam>
      -inferrel -inferdep -quiet -hide java.*
      -collpackages java.util.* -qualify
      -postfixpackage
      -nodefontsize 9 -nodefontpackagesize 7
    </additionalparam>
    ...
  </configuration>
</plugin>

This snippet shows only the relevant part for the integration of the doclet.

Limitations

Since the UML diagram is drawn automatically, you have no control over the layout.

This may result in a diagram not worth showing:

Or you may encounter a diagram that simply tells to much:

Despite this minor limitations we usually include the automatically generated diagrams in our Javadoc reports. If you want to add manually crafted diagrams, please have a look at our article Using PlantUML (this can probably also be done with UMLGraph).

References and other Resources


Link

Link

Posts