Friday, October 14, 2011

Maven Install on Mac


On Mac OS X 10.6, you will likely find maven already installed.


To check:
> mvn --version

> whereis mvn
/usr/bin/mvn

> ls -l /usr/bin/mvn
lrwxr-xr-x  1 root  wheel  24 Feb 26  2010 /usr/bin/mvn -> /usr/share/maven/bin/mvn

Most likely, your mvn is linked to /usr/share/maven/bin/mvn

> ls -l /usr/share/maven
lrwxr-xr-x  1 root  wheel  23 Oct 13 18:14 /usr/share/maven -> java/apache-maven-2.2.1


However, you may want to install a particular version of maven rather than the version 

Simply download maven at http://maven.apache.org/download.html
uncompress the file to get apache-maven-2.2.1 folder.  place that folder inside /usr/share/java/ folder.  

Remove the original /usr/share/maven link and link it to the new maven version. 
> sudo rm /usr/share/maven
> sudo ln -s /usr/share/java/apache-maven-2.2.1 /usr/share/maven

To check that things are done correctly:
> ls -l /usr/share/maven
> mvn --version