Maven忽略Jenv设置 [英] maven ignoring jenv settings
问题描述
我安装了装有Java 1.6
的OSX,并且我刚刚随Java 1.7
一起安装了jenv
:
I had OSX with Java 1.6
installed, and I just installed jenv
along with Java 1.7
:
$ jenv local '1.7'
$ jenv versions
system
1.6
1.6.0.65
* 1.7 (set by /Users/me/workspace/.java-version)
1.7.0.79
oracle64-1.6.0.65
oracle64-1.7.0.79
jenv
一直在工作,$ java -version
始终正常工作,当我将其设置为1.6时显示1.6,而当我将其设置为1.7时显示1.7:
jenv
is doing its job, with $ java -version
always working, showing 1.6 when I've set it to 1.6, and 1.7 when I've set it to 1.7:
$ java -version
java version "1.7.0_79" <--------------------------------- YAY!!
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
...但是maven忽略了我的设置:
$ mvn -version
Apache Maven 3.0.2 (r1056850; 2011-01-08 19:58:10-0500)
Java version: 1.6.0_65, vendor: Apple Inc. <--------------------------------- BAH!!
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
我发现了这个SO问题那个家伙只需要对他的硬编码在.mavenrc
内的JAVA_HOME
,但是我不想要我的硬编码(因此是jenv
!),而且我没有~/.mavenrc
,也没有/etc/mavenrc
.
I found this SO question where the guy just needed to hardcode his JAVA_HOME
inside .mavenrc
, but I don't want mine hard-coded (thus jenv
!), and I don't have a ~/.mavenrc
, nor an /etc/mavenrc
.
它使用的版本似乎来自/usr/libexec/java_home
输出中的第一个版本,因此在短期内,我可以通过调整1.7的Info.plist
文件(来自
The version it's using seems to be from whatever's first on the /usr/libexec/java_home
output, so in the short term I was able to get 1.6 back again by tweaking 1.7's Info.plist
file (from this SO post), but that just means I get 1.6 instead of 1.7.
有什么想法吗?
推荐答案
您需要安装jenv maven插件,尝试以下命令并重新加载Shell:
You need to install the jenv maven plugin, try the following command and reload your shell:
jenv enable-plugin maven
jenv enable-plugin maven
这篇关于Maven忽略Jenv设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!