Skip to content

Upgrading to Maven 2.1.0 on Macintosh OS X

Recently I found a Maven plugin that wouldn’t run under Maven version 2.0.6, and I had to upgrade it on my Macintosh. I quickly discovered the usual *nix upgrade (unpack, then update ${PATH}) didn’t seem to work, as the Macintosh OS X 10.5 comes with Maven pre-installed in /usr/share/ directory.

Tip – I found where it was installed with this simple series of *nix commands that should work on most Unix variants such as Linux, for anything on your ${PATH}, using the ‘which’ command:

CrazyMcphee:systems smcphee$ which mvn
/usr/bin/mvn
CrazyMcphee:systems smcphee$ ls -lrta /usr/bin/mvn
lrwxr-xr-x  1 root  wheel  24  9 Mar 22:50 /usr/bin/mvn -> \ 
  /usr/share/maven/bin/mvn

Following the information on this page as a template, here’s the procedure I used to upgrade to the latest version at time of writing, Maven 2.1.0:

CrazyMcphee:~ smcphee$ sudo su -
Password:
CrazyMcphee:~ root# cd /usr/share/
CrazyMcphee:share root# mv maven maven-2.0.6
CrazyMcphee:share root# cp -R \
/Users/smcphee/Development/systems/apache-maven-2.1.0/ \
maven-2.1.0
CrazyMcphee:share root# ln -s maven-2.1.0/ maven
CrazyMcphee:share root# exit
logout
CrazyMcphee:~ smcphee$ mvn -version
Apache Maven 2.1.0 (r755702; 2009-03-19 05:10:27+1000)
Java version: 1.5.0_16
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_AU, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.6" arch: "i386" Family: "unix"

You’ll note I used a symlink for the ‘maven’ directory to the ‘maven-2.1.0′ directory (the command ‘ln -s maven-2.1.0/ maven’ …). This is to allow me to quickly switch back to version 2.0.6 if I find any incompatibilities in my old POM files with the new version of Maven, by simply changing which directory the symlink points to.

4 Comments

  1. Robert wrote:

    I did basically the same thing, but I left /usr/share alone, and put my new Maven install in /opt…

    haven’t been game to try 2.1.0 yet; 2.0.10 broke-the-world again for me.

    Monday, March 23, 2009 at 13:47 | Permalink
  2. Scot Mcphee wrote:

    Ahh right. I’m just starting a new project, so for the moment, past compatibility doesn’t concern me, but it might later when I want to build some old projects.

    Monday, March 23, 2009 at 14:08 | Permalink
  3. Brett Porter wrote:

    @Robert – which issue is causing you problems in 2.0.10?

    Monday, March 23, 2009 at 18:14 | Permalink
  4. Robert wrote:

    @Brett – some minor ones, like the POM format got tightened, but the really annoying one for us was a change to the maven-dependencies-plugin (or more likely to one of the plexus module it uses) that broke the packaging of one of our EAR modules. The annoying part is that when we went back to 2.0.9, we still had the issue – we had to blow away the local repository to get rid of the plugins.

    It’s probably something wrong in our packaging that will be easy to correct once we identify it, but we’re fairly gun-shy when it comes to Maven upgrades – there have been more than one upgrade in the past where we couldn’t get a set of poms to work with both Maven 2.0.n and 2.0.(n+1). We haven’t yet got around to isolating the problem – too many other things on.

    (FWIW, most of our problems have been with the dependencies and the assembly plugins)

    Monday, March 23, 2009 at 23:22 | Permalink