Maven无法识别在bash_profile中设置的JAVA_HOME [英] Maven not recognizing JAVA_HOME being set in bash_profile
问题描述
将近2天的时间浪费在尝试正确安装Maven上.这些是我的输出.为什么世界上Maven默认使用我什至没有的jdk ???我已经尝试了从goole搜索中提出的一百万种不同的solutios,什么也没有!帮助.我尚未对任何配置文件(例如mvn.sh
)进行任何更改.
Going on nearly 2 days wasted trying to get maven properly installed. These are my outputs. Why in the world is maven defaulting to some jdk I don't even have??? I have tried a million different solutios proposed from goole searches and nothing!!! Help. I have not made any changes to any config files such as mvn.sh
.
System: Mac
OS=Yosemite 10.10
Java=Oracle 1.8 JDK
.bash_profile的内容:
contents of .bash_profile:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
export M2_HOME=/usr/local/Cellar/maven/3.2.3
export M2=$M2_HOME/bin
export PATH=$PATH:$M2_HOME/bin
终端命令:
java -version ->
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
mvn -version ->
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java
推荐答案
如果还有其他人碰巧遇到这个疯狂的愚蠢的解决方案,那就是我在主目录中有一个旧的.mavenrc文件,这引起了冲突.
If anyone else happens to run into this the crazy stupid solution was that I had an old .mavenrc file in home directory that was causing the conflict.
这篇关于Maven无法识别在bash_profile中设置的JAVA_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!