Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find javadoc command - maven

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] 
like image 629
user1508893 Avatar asked Dec 19 '12 21:12

user1508893


People also ask

How do I fix javadoc errors?

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).

How do I disable javadoc in Maven?

The Javadoc generation can be skipped by setting the property maven. javadoc. skip to true [1], i.e.

What is javadoc in Maven?

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.

How do I run a javadoc?

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.


1 Answers

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 
like image 182
miku Avatar answered Sep 17 '22 08:09

miku