You are not logged in.

#1 2020-02-14 17:04:16

GTP
Member
Registered: 2016-10-22
Posts: 4

Maven javadoc plugin fails to find javadoc

Hello everyone.
I'm trying to build a Java project that uses Maven as build system, but it fails with the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.1:javadoc (create-javadocs) on project apache-james-mpt-antlib: An error has occurred in Javadoc report generation: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]

What I find strange is that javadoc is in my path because if I try to run it i get:

$ javadoc
javadoc: error - No modules, packages or classes specified.
1 error

and I never needed to set java home, I've always used archlinux-java as explained in the wiki to set the default Java environment. Since I found no mention of setting JAVA_HOME in the wiki I'm unsure about setting it since it may not be the right way to fix this issue, at least on Arch. What should I do?
Thanks for your help

Offline

#2 2020-02-16 11:44:09

GTP
Member
Registered: 2016-10-22
Posts: 4

Re: Maven javadoc plugin fails to find javadoc

I've temporarily fixed this by manually setting JAVA_HOME to /usr/lib/jvm/java-11-openjdk since the project I was compiling uses java 11, but I still don't feel like this is the right solution since javadoc also appears in other java version's directories so which javadoc should be used may depend upon the Java version you're using. Maybe archlinux-java should also set JAVA_HOME when changing the default Java environment?

Offline

#3 2021-01-14 20:48:19

blacklight
Member
Registered: 2016-04-06
Posts: 3

Re: Maven javadoc plugin fails to find javadoc

I'm also facing similar issues when building other Java-dependent packages: java-15-openjdk doesn't come with the javadoc executable and the /usr/bin/javadoc symlink is broken. Setting JAVA_HOME to the java-11-openjdk path temporarily fixes things, but it sounds to me like something is quite wrong.

Offline

#4 2021-01-14 21:49:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 12,196

Re: Maven javadoc plugin fails to find javadoc

pacman -F /usr/lib/jvm/java-15-openjdk/bin/javadoc
usr/lib/jvm/java-15-openjdk/bin/javadoc is owned by extra/jdk-openjdk 15.0.1.u9-1

?

Javadoc has always been part of the jdk subset, you need to install all relevant packages.

Offline

Board footer

Powered by FluxBB