-
Notifications
You must be signed in to change notification settings - Fork 0
Maven Installation: Mac OS X
Note: All lines in code blocks should be sequentially executed in Terminal.
Install Homebrew.
Homebrew is an OS X package manager that allows convenient installation of thousands of modules.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Be patient until Homebrew has completed installation.
Install Maven.
This is where Homebrew's magic comes into play.
Run the following command:
brew install maven
This simple command will download, extract, and install the latest version of Maven and its respective dependencies.
Set environment variables.
Note: This tutorial assumes you installed Apache Maven 3.2.1. Replace 3.2.1 with the version you have downloaded. Check your version like so:
mvn --version
Unfortunately, you must manually export environment variables for Maven to properly function.
export M2_HOME=/usr/local/Cellar/maven/3.2.1
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
These commands will set Maven's environment variables in paths according to Homebrew's installation process.
Locate the path of your JDK installation and run the following command:
Note: The following command assumes your Java JDK installation is located here:
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
Verify Maven is installed correctly.
Simply check the version and make sure no errors pop up.
mvn --version
If all is well, congratulations! You've successfully installed Maven on Mac OS X.
Visit the site at tenjava.com
If you have any questions (about the contest, git, Maven etc), please don't hesitate to send us a tweet @tenjava or ask in our IRC channel.