I ran this command in my project directory to build and package it:
mvn clean javadoc:jar package
I do have my JAVA_HOME
variable set correctly. Evidently:
$ which java /usr/bin/java $ sudo ls -l /usr/bin/java lrwxr-xr-x 1 root wheel 74 Dec 18 23:42 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java $ which javadoc /usr/bin/javadoc
Does anyone know why mvn still complains?
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8:jar (default-cli) on project foo_bar: MavenReportException: Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]
You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).
The Javadoc generation can be skipped by setting the property maven. javadoc. skip to true [1], i.e.
javadoc:javadoc generates the Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool. javadoc:test-javadoc generates the test Javadoc files for the project. It executes the standard Javadoc tool and supports the parameters used by the tool.
To generate JavaDoc in Eclipse: –Select “Generate JavaDoc” option from Project menu and a wizard will appear. Specify the location for the JavaDoc file on your computer, by default it will be in the C drive. Select the project and then the packages for which you want to create the JavaDoc file.
A correct which java
is not evidence enough, since /usr/bin/
will likely be in your PATH
anyway. Check
$ echo $JAVA_HOME
for evidence. Or run
$ JAVA_HOME=/path/to/your/java/home mvn clean javadoc:jar package
On OS X you can set your JAVA_HOME
via:
$ export JAVA_HOME=$(/usr/libexec/java_home)
which on my machine points to
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With