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.
Use the following steps to generate Javadocs for a site:
project-with-documentation
.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>
mvn site
We added the Javadoc plugin to the reporting
section of pom
. When the Site plugin runs, it examines this section and runs the reports configured there. In this case, it found javadoc
and ran the relevant plugin to generate the Javadoc reports for the project.
Maven links the report from the site page in the Project Reports section.
What if we do not want to document the test classes, but only the source? We can configure the plugin to do this by performing the following steps:
reporting
section where we set the value of report
element to javadoc
:<reportSets> <reportSet> <reports> <report>javadoc</report> </reports> </reportSet> </reportSets>
mvn site
18.221.165.115