Generating Javadocs for a site

Documentation for Java projects is created using Javadocs. Maven provides support not only to generate Javadocs, but also to publish them as part of the site. Plugins configured within the reporting element will generate content for the site. When they are configured within the build element, they can generate reports independent of site.

How to do it...

Use the following steps to generate Javadocs for a site:

  1. Open the Maven project project-with-documentation.
  2. Add the following section in the pom.xml file:
    <reporting>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.1</version>
        </plugin>
      </plugins>
    </reporting>
  3. Run the following command:
    mvn site ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.