[英]Maven Refuses Java Home Directory
I followed the instructions to point Maven to the appropriate JDK via a /etc/mavenrc
file detailed here: How to change maven java home 我按照说明通过
/etc/mavenrc
文件将Maven指向相应的JDK,在这里进行了详细介绍: 如何更改Maven Java主页
When I then try to run maven, it fails, citing that the Java home directory is improperly defined because it's a directory. 然后,当我尝试运行maven时,它失败了,原因是Java主目录定义不正确,因为它是目录。
mvn --version /etc/mavenrc: line 1: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home: is a directory The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE
mvn --version / etc / mavenrc:第1行:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home:是目录JAVA_HOME环境变量未正确定义运行此程序需要此环境变量注意:JAVA_HOME应该指向一个JDK而不是一个JRE
My understanding is that Java_Home is supposed to be a directory. 我的理解是Java_Home应该是一个目录。 Why is it refusing to use the appropriate directory?
为什么拒绝使用适当的目录?
On a Mac the $HOME/.mavenrc
file should contain a JAVA_HOME declaration like in a shell script. 在Mac上,
$HOME/.mavenrc
文件应包含JAVA_HOME声明,如在shell脚本中一样。
ravn$ cat ~/.mavenrc
JAVA_HOME=/Users/ravn/Downloads/zulu7.22.0.3-jdk7.0.171-macosx_x64
ravn$
This is a nice feature which is not very well documented. 这是一个很好的功能,没有很好的记录。
I have the same problem and have been trying to solve it for an hour. 我有同样的问题,并且一直试图解决一个小时。 I have
JAVA_HOME
pointed to the correct jdk location by using the following line but still has this problem. 我通过使用以下行使
JAVA_HOME
指向正确的jdk位置,但是仍然存在此问题。
export JAVA_HOME=$(/usr/libexec/java_home)
How I fix it finally is to paste the same line above to .mavenrc
我最终如何解决的是将上面的同一行粘贴到
.mavenrc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.