Using Alternate Javadoc Tool

Using Alternate Javadoc Executable

By default, the Maven Javadoc Plugin tries to auto-detect the Javadoc Tool executable from the Java property java.home or from the environment variable JAVA_HOME.

You could also specify the executable of the Javadoc Tool to use with the <javadocExecutable/> parameter. For example:

  1. <project>
  2. ...
  3. <reporting> (or <build>)
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-javadoc-plugin</artifactId>
  8. <version>3.11.2</version>
  9. <configuration>
  10. <javadocExecutable>C:\jdk1.6.0\bin\javadoc.exe</javadocExecutable>
  11. ...
  12. </configuration>
  13. </plugin>
  14. ...
  15. </plugins>
  16. </reporting> (or </build>)
  17. ...
  18. </project>

IMPORTANT NOTE: by using <javadocExecutable/> parameter, the build will be plateform dependent! A good practice is to define an environnement variable (i.e. JAVA_1.6_HOME), so you could specify it: (i.e. <javadocExecutable>${env.JAVA_1.6_HOME}/bin/javadoc</javadocExecutable>). An other ways is to define a POM property using <project><properties/></project>.

Using Alternate Javadoc Version

In the same way, the Maven Javadoc Plugin tries to auto-detect the Javadoc Tool version by calling javadoc -J-fullversion.

You could also specify the version of the Javadoc Tool executable. For example:

  1. <project>
  2. ...
  3. <reporting> (or <build>)
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-javadoc-plugin</artifactId>
  8. <version>3.11.2</version>
  9. <configuration>
  10. <javadocVersion>1.5</javadocVersion>
  11. ...
  12. </configuration>
  13. </plugin>
  14. ...
  15. </plugins>
  16. </reporting> (or </build>)
  17. ...
  18. </project>

Note: You could have a warning if the javadocVersion specified is not the same that the Javadoc Tool executable.