Using Alternative Output Directory
To run the Javadocs reports in an other output directory, you need to configure Javadoc Plugin as follow:
<project> ... <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.6.2</version> <configuration> <reportOutputDirectory>${project.reporting.outputDirectory}/myoutput</reportOutputDirectory> <destDir>myapidocs</destDir> ... </configuration> </plugin> ... </plugins> </reporting> ... </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.