2

I am trying to run 'mvn install' from maven eclipse plugin as follows


The build fails and throws MavenReportException:

Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set.

However, I tried executing echo $JAVA_HOME and it displays /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home. Command java -version also displays the appropriate version.

Moreover, when I try running 'mvn install' from terminal the build succeeds. Why is build failing when running from eclipse maven plugin?

Any help would be appreciated.

user2938723
  • 1,100
  • 1
  • 10
  • 15

2 Answers2

4

There is a difference between running from command line and from within eclipse. Each has its own variables. Your error states that you do not have set JAVA_HOME (in eclipse).

So, it seems like you have to set JAVA_HOME in eclipse.

This SO thread and this one can help.

HTH

How to change JAVA.HOME for Eclipse/ANT

Setting up Eclipse with JRE Path

Community
  • 1
  • 1
OhadR
  • 8,276
  • 3
  • 47
  • 53
0

Navigate to project->java build path->libraries->select "JRE System Library", click Edit and select "Workspace default JRE".

edit: Also try Execution Environment -> Compatible JREs & set correct JRE. (Or) Edit the eclipse.ini file to point to your jdk home, something as follows - -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home

gashu
  • 484
  • 6
  • 17