Maven, has been my project build centric tool for many years now. I have never really had an issue updating to the latest version on Windows, Linux or Unix environments, but every-time I update Mac, I tend to forget the subtleties in the process, so I thought I would blog my findings.

1. download the zip version

Latest: http://maven.apache.org/download.html

2. Unpack the archive on your Desktop by double clicking it.

It will extract to a folder called maven-2.x.x (ie maven-2.2.0)

3. Open Terminal and issue the following commands:

sudo mv ~/Desktop/maven-2.2.0 /usr/share

NOTE: If you cannot use sudo because of local restrictions you can install it locally, perhaps in your home directory somewhere. Just substitute the path you use in the following steps.


4. Update any symlink you might have to the new Maven directory:
cd /usr/bin
sudo rm mvn (where mvn was my old symlink)
ln -s /usr/share/maven-2.2.0/bin/mvn mvn

You now have a symlink /usr/bin/mvn -> /usr/share/maven-2.2.0/bin/mvn

5. Test:
mick-knutsons-macbook:bin mickknutson$ mvn -v
Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
Java version: 1.6.0_15
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: “mac os x” version: “10.5.8” arch: “x86_64” Family: “mac”

I think the reason I was originally stumped, is because I was not expecting just the binary being distributed with Mac OS X. I was actually thinking nothing would get distributed, but Maven binary gets shipped from the factory.

I also tend to put my installations under /usr/sbin/** or /usr/bin/**, but somewhere I came across /usr/share/** which is where this installation ended up. I will most likely move the installation when I upgrade next time. But for now, I have work to do…

Hope this helps.

Mick Knutson

Java, JavaEE, J2EE, WebLogic, WebSphere, JBoss, Tomcat, Oracle, Spring, Maven, Architecture, Design, Mentoring, Instructor and Agile Consulting. http://www.baselogic.com/blog/resume

View all posts

Java / JavaEE / Spring Boot Channel

BLiNC Supporters

BLiNC Adsense

Archives

Newsletter