Maven Tutorials – Generating Javadocs in maven

Previous – Chapter 12

Maven Tutorial – Chapter 13

Maven comes out with one of the cool features which does the generation of the javadocs for a project. As every developer knows that it is vital to have the code documentation of our project and this feature of maven helps to accomplish the same.

Maven uses the “maven-javadoc” plugin to generate the javadocs of a project. This plugin internally uses “JDK\bin\javadoce.exe” command to generate javadocs. When the project is deployed using “mvn install” command, it generates the javadocs for the project.

The javadoc plugin can be configure for any project in pom.xml as shown below:

<build>
       <plugins>
              <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId><span style="text-decoration: underline;">maven</span>-<span style="text-decoration: underline;">javadoc</span>-<span style="text-decoration: underline;">plugin</span></artifactId>
                     <executions>
                           <execution>
                                  <id>attach-<span style="text-decoration: underline;">javadocs</span></id>
                                  <goals>
                                         <goal>jar</goal>
                                  </goals>
                           </execution>
                     </executions>
              </plugin>
       </plugins>
</build>

jd_1

jd_2

The generated javadocs can be found in the project’s location D:\Java\workspace\JavaSamples\target\apidocs

Next – Chapter 14

 


Comments

Questions? Comments? Suggestions? Let us know!! Like / Subscribe / Follow for more updates.