Alex headshot

AlBlue’s Blog

Macs, Modularity and More

Maven 3.0 on OSX

2010, java, mac

Just a quick note for those that have installed Maven 3.0 on OSX – the JavaToolsLeopard installed Maven 2.0.9 into /usr/share/java/maven-2.0.9, and the Java for 10.6 update 2 installed MAven 2.2.0 into /usr/share/java/maven-2.2.0, with symlinks for /usr/bin/mvn into the appropriate directories. This means if you install Maven 3.0 elsewhere, running mvn will get you the stock install that comes with OSX's Java tools.

If you follow the instructions on the Apache install page, you'll get success; it says to set up the PATH such that it's ${M2}:${PATH}. However, if you set it the wrong way around (${PATH}:${M2}) but still have M2_HOME pointing to the Maven 3.0 location, then you may end up with a java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher message.

The solution is to make sure you have the right path ordering, or remove/update the /usr/bin/mvn symlink to point to the Maven 3.0 location. It's almost certain that Apple will not update to Maven 3.0 in the 10.6 timeframe, though it may do for the 10.7 timeframe.