Ensuring MAVEN_HOME is set correctly

强颜欢笑 提交于 2019-12-11 02:16:44

问题


A Java and Maven noob here:

Using OSX 10.8

And Installed Maven with HomeBrew

1- If I say which mvn I will get this: /usr/local/bin/mvn

2- If I say echo $MAVEN_HOME I will get nothing back.

3- If I go to my Maven Installation on EClipse it will look like this:

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?


回答1:


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 will use M2_HOME to find the Maven installation. Edit or create /etc/launchd.conf:

setenv M2_HOME /usr/share/maven

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.



来源:https://stackoverflow.com/questions/15709845/ensuring-maven-home-is-set-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!