Fail to execute javadoc-plugin on Mac OSX (JAVA_HOME issue)

While building project with maven following error occurs:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.7:jar 
(attach-javadocs) on project api: MavenReportException: 
Error while creating archive:Unable to find javadoc command: 
The environment variable JAVA_HOME is not correctly set. -> [Help 1]

This happens, because JAVA_HOME points to JRE instead of JDK dir.
In my case it’s being set by the following command

export JAVA_HOME=$(/usr/libexec/java_home)

and points to

/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home

Quick solution for this problem is adding the following inside properties tag :

<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha Captcha Reload

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">