Monday, March 21, 2011

Downgrade/Upgrade Mac OS X maven version

If you recently upgrade your JVM using apples automatic upgrades, you might notice that other java dependencies were upgraded as well.

All of a sudden my MVN project stop working and it wasn't because of the JAVA upgrade to the JVM, it was because MVN it also got upgrade from 2.2.1 to 3.0.2.

Notes:
For this tutorial to work, you need to have a soft link shown in step 3.
If you have a directory, then follow this solution: http://www.gridshore.nl/2008/01/28/upgrading-maven-on-the-mac/

Follow this steps to downgrade:

1. Verify that you have the desired maven version here:
/usr/share/java


drwxr-xr-x   9 root  wheel  306 Jul 20  2009 apache-maven-2.0.9
drwxr-xr-x   9 root  wheel  306 May 21  2010 maven-2.2.0
drwxr-xr-x   9 root  wheel  306 Sep 21 14:10 maven-2.2.1
drwxr-xr-x   9 root  wheel  306 Mar 21 09:39 maven-3.0.2


2. If your version is there you will be fine, if it's not, then you will have to download and unzip/untar the version you want in this directory (http://maven.apache.org/download.html).

3. Now check that you have a soft link here pointing to maven.
/usr/share

It will look like this:
lrwxr-xr-x    1 root   wheel    16 Mar 21 10:16 maven -> java/maven-3.0.2

4. Now we will change to the desired version:
sudo rm maven
sudo ln -s java/maven-2.2.1 maven

5. Open a new terminal window and verify that the change was successful:
mvn -version


Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_24
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.6" arch: "x86_64" Family: "mac"

Enjoy.

No comments:

Post a Comment