Friday, October 31, 2014

Maven: updating version on Mac

In this tutorial we will discuss upgrading Maven on Mac OS X.

While trying building with Maven I was getting errors related to version number (below 3.1) 

mvn install
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

To update my maven I have to do the following sequence of steps.

$ mvn -version

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 07:51:28-0600)

I had to uninstall the older version 3.0

$ brew uninstall maven30

Uninstalling /usr/local/Cellar/maven30/3.0.5...

Trying to install newest I noticed that I tried it before, but it was not linked

$ brew install maven

Warning: maven-3.2.3 already installed, it's just not linked

The easiest way to fix that is to uninstall and install again:

$ brew uninstall maven

Uninstalling /usr/local/Cellar/maven/3.2.3...
$ brew install maven

==> Downloading downloaded: /Library/Caches/Homebrew/maven-3.2.3.tar.gz
🍺  /usr/local/Cellar/maven/3.2.3: 76 files, 8.0M, built in 3 seconds
uki@ CNH_PROD $ mvn -version
Apache Maven 3.2.3