What's new? | Help | Directory | Sign in
Google
             
Join project
Project owners:
  trustin

What is APIviz?

APIviz is a JavaDoc doclet which extends the Java standard doclet. It generates comprehensive UML-like class and package diagrams for quick understanding of the overall API structure.

Samples

Basic Usage

If you are using Ant or Maven 2, please follow the instructions below.

Doclet Tags

APIviz automatically discovers the relationship between packages and classes and their stereotype by default. Additionally, you can use the following doclet tags to add more relationships or to make the generated diagram look cleaner.

@see and @deprecated tags are also recognized.

Prerequisites

You must have JDK 1.5+ and Graphviz installed in your system. If Graphviz is not found in your system path, it will automatically fall back to the standard doclet with a warning message. Alternatively, you can specify the directory where dot or dot.exe is located with the Java system property - graphviz.home (e.g. -Dgraphviz.home=C:\Program Files\Graphviz-2.20.2\bin).

Ant Integration

Modify your build.xml's javadoc task:

  <javadoc ...
           doclet="net.gleamynode.apiviz.APIviz"
           docletpath="apiviz-1.1.3.jar"
           additionalparam="-author -version ...">
    ...
  </javadoc>

Please note that additionalparam attribute is used instead of the standard doclet attributes. It is because some Ant versions don't pass the standard doclet attributes to a custom doclet even if it extends the standard doclet.

Maven 2 Integration

First, add APIviz Maven repository in your pom.xml:

  <repositories>
    ...
    <!-- APIviz repository -->
    <repository>
      <id>apiviz.release</id>
      <name>APIviz releases</name>
      <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    ...
  </repositories>

In the plugins section, add the maven-javadoc-plugin:

  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <doclet>net.gleamynode.apiviz.APIviz</doclet>
          <docletArtifact>
            <groupId>net.gleamynode.apiviz</groupId>
            <artifactId>apiviz</artifactId>
            <version>1.1.3</version>
          </docletArtifact>
          <additionalparam>
            -charset UTF-8
            -docencoding UTF-8
            -version
            -author
            -breakiterator
            -linksource
            -sourcetab 4
            -windowtitle "${project.name} ${project.version} API Reference"
            -doctitle "${project.name} ${project.version} API Reference"
            -bottom "Copyright &#169; ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
            -link http://java.sun.com/javase/6/docs/api/
          </additionalparam>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </build>

Please note that the additionalparam tag is used instead of ordinary configuration tags. It's because the maven-javadoc-plugin has no idea if APIviz is a doclet which extends the standard doclet (See the related issue tracker page.)

Feed Back

Do you have a good idea to improve APIviz? Please e-mail me: trustin@gmail.com (Trustin Lee)

Changes