Maven – Change Javadoc Directory

In Maven, u can create the javadoc by the maven-javadoc-plugin. Just include it in the pom.xml as follow.

...
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<version>2.6.1</version>
</plugin>
...

Then run the following maven command and you will find the javadoc at ~/target/site/apidocs.

  • mvn javadoc:aggregate

If you want to change to output directory of the javadoc, edit the pom.xml as follow.

...
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<version>2.6.1</version>
	<configuration>
		<reportOutputDirectory>${project.basedir}/target/build</reportOutputDirectory>
		<destDir>javadoc</destDir>
	</configuration>
</plugin>
...

Now the javadoc will be located at ~/target/build/javadoc.

Reference: Using Alternative Output Directory

Done =)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.