Upgrade Maven on OS X

 

Apache maven is a versatile project management and comprehension tool. It is based on project object model (POM). Maven could be used to build a project, report and document from a focal piece of information. You can also write plugins for Maven to extend it functionality. Maven is an open source project too!

I had an older version of maven installed in my mac, so to upgrade it I followed these simple steps.

  • I had installed maven using HomeBrew, so it had symlinks, but you need to find out where is your maven being run from, for that, run this comamnd,

$ which mvn

/usr/local/bin/mvn 

  • Now, go to folder /usr/local/bin/mvn, and run command,

cd /usr/local/bin/

ls -ls | grep mvn

8 lrwxr-xr-x  1 nhst  admin      29 Sep 16  2014 mvn -> ../Cellar/maven/3.2.3/bin/mvn

8 lrwxr-xr-x  1 nhst  admin      34 Sep 16  2014 mvnDebug -> ../Cellar/maven/3.2.3/bin/mvnDebug

8 lrwxr-xr-x  1 nhst  admin      32 Sep 16  2014 mvnyjp -> ../Cellar/maven/3.2.3/bin/mvnyjp

As you can see that its all symlinked to Cellar directory, which is owned by HomeBrew.

  • Now, run these commands,

$ brew update

$ brew unlink maven

$ brew install maven

And, that is it, you will have the latest Maven version installed on your system, just do mvn --version and check for yourself!