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


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


Leave a Reply