确保正确设置MAVEN_HOME [英] Ensuring MAVEN_HOME is set correctly
问题描述
这里有Java和Maven noob:
A Java and Maven noob here:
使用OSX 10.8
Using OSX 10.8
使用HomeBrew安装Maven
And Installed Maven with HomeBrew
1-如果我说哪个mvn
我会得到这个: / usr / local / bin / mvn
1- If I say which mvn
I will get this: /usr/local/bin/mvn
2-如果我说 echo $ MAVEN_HOME
我什么也得不回来。
2- If I say echo $MAVEN_HOME
I will get nothing back.
3-如果我在EClipse上进入我的Maven安装,它将如下所示:
3- If I go to my Maven Installation on EClipse it will look like this:
4-如果我去Maven IntelliJ中的设置如下所示:到目前为止,我已经能够使用IntelliJ运行Maven目标。
4- If I go to Maven settings in IntelliJ, it will look like this: So far I have been able to run Maven goals with IntelliJ.
好的,这就是我的全部。您能否请一看,看看我遇到的不一致之处是什么,以及要在各地正确设置这些内容需要解决的问题?
Ok That's all I have. Can you please take a look and see what are the inconsistencies I am having and what things to fix to set this correctly everywhere?
推荐答案
在Mac OS X下,您应该在 /etc/launchd.conf中设置环境变量
。 launchd加载的变量可以在shell和Intellij IDEA等GUI应用程序中使用。
Under Mac OS X you should setup your environment variables in /etc/launchd.conf
. Variables loaded by launchd are available in your shell as well as in GUI applications like Intellij IDEA.
Intellij IDEA将使用M2_HOME查找Maven安装。编辑或创建 /etc/launchd.conf
:
Intellij IDEA will use M2_HOME to find the Maven installation. Edit or create /etc/launchd.conf
:
setenv M2_HOME /usr/share/maven
不幸的是,要查看效果,您必须重启机器。另一个缺点是,您不能在文件中使用空格。这意味着,您无法将MAVEN_OPTS设置为多个值。
Unfortunately to see the effect, you have to reboot your machine. Another shortcoming is, that you cannot use spaces in the file. This means, you cannot set MAVEN_OPTS to more than one value.
这篇关于确保正确设置MAVEN_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!