When building https://gerrit.wikimedia.org/r/wmf-jvm-utils with Java 11 I encounter:
[INFO] --- maven-javadoc-plugin:3.2.0:jar (attach-javadocs) @ http-client-utils --- [ERROR] MavenReportException: Error while generating Javadoc: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. org.apache.maven.reporting.MavenReportException: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport (AbstractJavadocMojo.java:2019) ... Caused by: java.io.IOException: The environment variable JAVA_HOME is not correctly set.
The reason is Java 9 moved javadoc to JAVA_HOME/bin/javadoc and the Maven javadoc plugin 3.2.0 does not take that in account. A workaround is to set javadocExecutable using Maven profiles varying based on the JDK version has I have done in https://gerrit.wikimedia.org/g/integration/gearman-java :
<profiles> <profile> <id>jdk-8-config</id> <activation> <jdk>1.8</jdk> </activation> <properties> <javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable> </properties> </profile> <profile> <id>jdk-11-config</id> <activation> <jdk>11</jdk> </activation> <properties> <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable> </properties> </profile>
After some digging, that got fixed upstream MJAVADOC-650 / Pull request 60 which handles the relocation.
The fix has been released in maven-javadoc-plugin 3.3.0.
Both wmf-jvm-utils and integration/gearman-java get it from our parent-pom https://gerrit.wikimedia.org/g/wikimedia/discovery/discovery-parent-pom/+/refs/heads/master which has:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.2.0</version>
It should be upgraded to 3.3.0 and the downstream repositories updated.