Skip to content

Commit

Permalink
Workaround javadoc problem with Java 11
Browse files Browse the repository at this point in the history
When building with "make JAVA_VERSION=11 ..." I got an error about JAVA_HOME
not being set:
  Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.0:jar
  (attach-javadocs) on project kafka-agent: MavenReportException: Error while
  generating Javadoc: Unable to find javadoc command: The environment
  variable JAVA_HOME is not correctly set. -> [Help 1]

Rather than forcing people to set JAVA_HOME (which is the fallback maven-javadoc-plugin uses for finding the javadoc executable) configure the executable location directly according to the JVM being used to run maven.

See https://stackoverflow.com/questions/57081473/how-to-make-maven-javadoc-plugin-work-with-any-java-version

Signed-off-by: Tom Bentley <[email protected]>
  • Loading branch information
tombentley committed Dec 12, 2019
1 parent 582b524 commit 9fa94bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -852,5 +852,23 @@
<maven.compiler.target>${env.JAVA_VERSION}</maven.compiler.target>
</properties>
</profile>
<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>
</profiles>
</project>

0 comments on commit 9fa94bf

Please sign in to comment.