Can you believe it, when you have Mac os-x 10.5 running, maven is pre-installed. If you are not programming java you practically do not care about it. But if you are not programming java you will not find this blog very interesting as well :-). So especially for those that like their Mac, program java and want to upgrade there maven version from 2.0.6 to for instance 2.0.8, this is what you need to do. You can find your current maven installation in he folder:

/usr/share/maven

This is a protected directory, so you’ll need some sudo commands here to do anything. I downloaded the file "apache-maven-2.0.8.zip". On my system, zip files get extracted after download. Therefore I need a "mv" command. I did keep the original files by the way. You’ll need these commands:

cd /usr/share
sudo mv maven maven206
sudo cp -R /Users/jettro/Downloads/apache-maven-2.0.8 maven

Now it is time to check, just to be sure, open a new command shell and type the following command:

mvn -version

That should result in:


jettro:~ jettro$ mvn -version
Maven version: 2.0.8
Java version: 1.5.0_13
OS name: "mac os x" version: "10.5.1" arch: "i386" Family: "unix"

Now you have maven 2.0.8 available

One final remark, if you have changed the settings.xml file, do not forget to copy this back to the new folder.

Tagged on:

18 thoughts on “Upgrading maven on the mac

  • Pingback: Upgrade maven and switch between versions using bash on the mac « Gridshore

  • September 20, 2010 at 9:39 am
    Permalink

    The original Maven is installed into /usr/share/java (Mac OS 10.6.5). Just extract and copy your version of Maven to that directory (unzip apache-maven… sudo mv apache-maven… /usr/share/java). Then remove the old symbolic link to maven (sudo rm /usr/share/maven) and finally create a new symbolic link to the new maven (sudo ln -s /usr/share/java/apache-maven… /usr/share/maven)

    Reply
  • Pingback: let x=x › Upgrading to Maven 2.1.0 on Macintosh OS X

  • Pingback: Getting Started with Cocoon 2.2 Under Mac OS X Leopard (1.5) « A Content Manifesto

  • February 5, 2009 at 11:32 pm
    Permalink

    This tip is great. Then only thing I would do different is to use links.

    After moving /usr/share/maven to maven-2.0.6 copy the new maven version to /usr/share/maven-2.0.9.
    Then create a link whit the command ln -s /usr/share/maven-2.0.9 maven

    after youe ar done the structure should be somthing like this:

    $ ll | grep maven
    lrwxr-xr-x 1 root wheel 22 Feb 5 23:20 maven@ -> /usr/share/maven-2.0.9
    drwxr-xr-x 10 root wheel 340 Feb 5 23:18 maven-2.0.6/
    drwxr-xr-x@ 9 larsduvaas admin 306 Feb 5 09:36 maven-2.0.9/

    Just change the link and you will be able to swap beetwen version very easy.

    Reply
  • January 9, 2009 at 9:16 pm
    Permalink

    Ah yes, and you don’t have to meddle with modifying your path to point to the right version of Maven. The Apple bundled Maven sits in /usr/bin/ which is higher in priority than anything else you add in your path.

    Reply
  • January 9, 2009 at 9:15 pm
    Permalink

    Actually, the macports.org option is NOT easier. For Leopard users, who have Maven bundled with the OS, I think using macports to bring Maven 2.0.9 is actually very bad. The reason is that it does not remove the old maven from /usr/share/maven, so you have junk in your system.

    I am a heavy user of macports, don’t get me wrong – I love it. But in the case of Maven, and because it was bundled by Apple with Leopard, the method in this blog post is far superior.

    Reply
  • October 30, 2008 at 8:43 pm
    Permalink

    Thanks a bunch for posting this helpful info on the web

    Reply
  • October 8, 2008 at 9:59 pm
    Permalink

    Thanks for the tip.

    Reply
  • July 27, 2008 at 7:48 am
    Permalink

    I agree with you that this looks pretty interesting. There is a but. You need to install http://www.macports.org in order to use it, which requires XCode3.0, which is not something everybod needs to have on his pc. I am also not sure how it is installed? Does it remove the old version?

    But anyhow, thanks for the suggestion, for people having macports installed, this is by far the easiest method I have seen.

    Reply
  • July 22, 2008 at 3:41 pm
    Permalink

    Thanks for the tips on your blog.
    I like the way you call “bullshit” on marketing driven drip….

    Reply
  • Pingback: casarini.org » Blog Archive » Maven & Java 1.4 under Mac OS 10.5

  • February 1, 2008 at 3:13 am
    Permalink

    Hey thanks for the tip. We’re switching to Maven at work so I had just installed 2.0.8 on my mac and, following installation instructions, had put it at /usr/local/apache-maven/… I got it working using export commands to set the path correctly. I then switched to another shell and ran mvn -version expecting it to fail as the path wasn’t set in that shell. To my surprise the 2.0.6 version answered!

    So I googled and found your helpful tip here. Cheers.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>