Using Alternative Output Directory

To run the Javadocs reports in an other output directory, you need to configure Javadoc Plugin as follow:

  1. <project>
  2. ...
  3. <reporting>
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-javadoc-plugin</artifactId>
  8. <version>2.10.4</version>
  9. <configuration>
  10. <reportOutputDirectory>${project.reporting.outputDirectory}/myoutput</reportOutputDirectory>
  11. <destDir>myapidocs</destDir>
  12. ...
  13. </configuration>
  14. </plugin>
  15. ...
  16. </plugins>
  17. </reporting>
  18. ...
  19. </project>

Running mvn javadoc:javadoc will output the Javadoc in the ${project.reporting.outputDirectory}/myoutput/myapidocs instead of the default directory, i.e. ${project.reporting.outputDirectory}/apidocs.

Note: Running mvn site will automatically use the ${project.reporting.outputDirectory} directory and in this case, reportOutputDirectory has no effect. Only, testDestDir and destDir could be used.