Generating Javadocs in Maven

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.

Configuring Javadocs Plugin

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


Generating Javadocs

After adding the above mentioned plugin in your project's pom.xml, all you have to do is, open the command prompt, go to the project directory, For eg. D:\Java\workspace\JavaSamples and run the command maven install.

Generating Javadocs in Maven

Generating Javadocs in Maven

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