![maven install in mac maven install in mac](https://i.ytimg.com/vi/nOISgU25YpA/maxresdefault.jpg)
#Maven install in mac how to#
You can find more details on where and how to update your path to point to the bin folder here Once you have extracted the folder, update the PATH so that it contains the path to the bin folder of the extracted Maven folder (For example adding /usr/local/apache-maven-3.5.4/bin).
#Maven install in mac zip#
#Maven install in mac download#
Firstly, you will need to download the ‘Binary Zip Archive’ of Maven from here:.If there is anything missing or not clear in this guide, please leave a comment below. This page provides details around how to install Maven. Maven is a build automation tool that manages how a Java project is built and the it’s dependencies. If you’re are facing problems with finding JAVA_HOME you might also want to check this article on Stack Overflow: Where is JAVA_HOME on OSX Lion?.To build a Java project you will need the tool Maven installed. I didn’t have that file on my system so I created it with:Įcho JAVA_HOME=`/usr/libexec/java_home -v 1.7` | sudo tee -a /etc/mavenrcįinally Maven was picking up Java 7 both when run from the shell and from eclipse.
![maven install in mac maven install in mac](https://s1.o7planning.com/en/10101/images/1060028.png)
It turned out that Maven loads settings from /etc/mavenrc if that file exists. Eclipse was started from a shortcut to Eclipse.app rather than a shell so the JAVA_HOME variable was not set. Now I tried to launch mvn from within eclipse but got “ Fatal error compiling: invalid target release: 1.7″. ~/bash_profile but I decided to keep them in ~/.profile and instead load it from ~/.bash_profile using:Īfter fixing the shell initialization files Maven was picking up Java 7 as expected. To use the settings in ~/.profile I could had moved them to. Looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. It turned out that brew had created a ~/.bash_profile file and the bash shell (from the bash man page): The JAVA_HOME environment variable was set in ~/.profile:Įxport MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128M"Įxport JAVA_HOME=`/usr/libexec/java_home -v 1.7`īut it was not exported. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Homeĭefault locale: en_US, platform encoding: MacRoman Java version: 1.6.0_41, vendor: Apple Inc. Maven home: /usr/local/Cellar/maven/3.0.4/libexec Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode) Java(TM) SE Runtime Environment (build 1.7.0_11-b21) Both Java 6 and Oracle Java 7 was installed on the system with the default JVM set to Java 7: I had a Mac with OS X Mountain Lion (10.8.2) and Maven 3.0.4 (Maven installed using “brew install maven”). Recently I switched to Java 7 and then ran into a couple of issues.