Thursday, March 12, 2009

Maven on Leopard

Mac OS X keeps updating and installing patches which has broken my maven installation a couple of times.

Looked around for a solution and there really was not one place that could help. Well finally figured out the problem and just thought I would post it in case anyone happened to run into it.

1.) install maven. I like to do everything in a local directory in my home directory. So something like ~/local/apache-maven/apache-maven-2.0.10 would be the target install directory.
2.) Fire up ~/.bash_profile in an editor and type in the following:

export M2_HOME=/Users/svemuri/local/apache-maven/apache-maven-2.0.10/
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
export PATH=M2_HOME/bin:/usr/local/bin:$JAVA_HOME:$PATH

This way the mvn and java that you specify will be the ones running and not the ones installed by default by Mac OS X. Of course you can use any of the versions that you choose to and you could point to /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home if you wish to use JDK 1.6.

This should fix the following problems:
Permission Denied when running mvn
NoClassDefFoundError for a Launcher class.