|
|
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
- Set the value of the -doclet option to: net.gleamynode.apiviz.APIviz
- Set the value of the -docletpath option to: path/to/apiviz-<version>.jar
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.
- @apiviz.stereotype <stereotype> - Assigns a stereotype to a class
- @apiviz.landmark - Highlight a class or a package
- @apiviz.hidden - Hides a class from the package overview diagram
- @apiviz.exclude <regex> - Excludes the classes that matches the regular expression
- @apiviz.inherit - Inherits the exclusion patterns of the package where a class belongs
- @apiviz.uses <FQCN> - Adds a dependency relationship
- @apiviz.has <FQCN> - Adds a navigability relationship
- @apiviz.owns <FQCN> - Adds an aggregation relationship
- @apiviz.composedOf <FQCN> - Adds a composition relationship
@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 © ${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
- 1.1.3 - 21 July 2008
- Fixed a 'ugly output' warning in Microsoft Windows.
- Fixed a bug where JavaDoc generation fails when there's only one package.
- 1.1.2 - 16 July 2008
- Contributed by Heiko Feldker <heiko/dot/feldker/at/googlemail/dot/com>
- Fixed a bug where Graphviz is not detected in Microsoft Windows.
- Added graphviz.home system property to specify the directory where the Graphviz executable is located.
- 1.1.1 - 12 July 2008
- Fixed a bug where @apiviz.hidden tag doesn't hide a class in a certain case.
- Fixed a bug where @apiviz.exclude tag excludes even a central class in a diagram.
- 1.1.0 - 4 July 2008
- Edges are drawn more smartly so that the resulting diagram is more compact.
- 1.0.5 - 2 July 2008
- Fixed a bug where an escape character (e.g. '\n') is displayed in a tooltip.
- 1.0.4 - 27 June 2008
- Fixed a bug where an arrow tail is not drawn.
- 1.0.3 - 26 June 2008
- Applied a workaround for a NullPointerException raised from inside JDK
- 1.0.2 - 26 June 2008
- Fixed a bug where package dependency graph is calculated incorrected.
- Added support for @deprecated tag - a deprecated class or package will be represented as a dotted box.
- 1.0.1 - 26 June 2008
- Fixed a bug where a nested class is not handled properly.
- 1.0.0 - 26 June 2008
- Initial release
