Ensuring MAVEN_HOME is set correctly

13,462

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.

Share:
13,462
DarkNightFan
Author by

DarkNightFan

Updated on June 04, 2022

Comments

  • DarkNightFan
    DarkNightFan almost 2 years

    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:

    enter image description here

    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.

    enter image description here

    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?