Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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
    
  4. See the report generated:

  5. Click on the JavaDocs link:

How it works...

We added the Javadoc plugin to the reporting section of pom. When the Site plugin...