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.10.1</version>
        <configuration>
          <reportOutputDirectory>${project.build.directory}/myoutput</reportOutputDirectory>
          ...
        </configuration>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

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

Note: Running mvn site will automatically use the ${project.reporting.outputDirectory} directory and in this case, <reportOutputDirectory /> has no effect.