Generating documentation automatically

Both Ant and Maven use the Javadoc tool to automatically generate documentation. If you are using Ant, simply navigate to a project's root directory and enter the following command:

$ ant javadoc
Buildfile: build.xml
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source file /home/packt/...
[javadoc] Constructing Javadoc information...

For Maven you first have to add the javadoc plugin. To do this, edit the pom.xml file and add the following lines at the corresponding location:

<project> ... <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8</version> <configuration> ... </configuration> ...

Get Sonar Code Quality Testing Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.