Update: This works just as well on OS X Mavericks. Also, if you need to add legacy Java 1.6 support back into your system, download and install Java for OS X 2014-001.
My MacBook Pro has Maven 3.0.3 on it:
$ mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 17:31:09+0000)
Maven home: /usr/share/maven
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
I don't want that. I want Maven 2.2.1.
/usr/share/maven
is just a symlink to the install directory, so install version 2.2.1 and swap the symlink. Done.
Install Maven 2.2.1 using Homebrew:
brew tap homebrew/versions
brew install maven2
==> Downloading http://www.apache.org/dist/maven/maven-2/2.2.1/binaries/apache-maven-2.2.1-bin.tar.gz
######################################################################## 100.0%
Move the symlink and recreate:
cd /usr/share
sudo mv maven maven-3.0.3
sudo ln -s /usr/local/Cellar/maven2/2.2.1 maven
Now check:
mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)
Java version: 1.6.0_51
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.8.4" arch: "x86_64" Family: "mac"
Lovely. Job done.