So apparently, the latest Java update to OS X Snow Leopard broke Maven 2 support. It did so in a rather nasty way;
For over a year now I’m used to my symlink (/usr/share/maven) being reset from my custom Maven2 installation to the Maven3 installation that comes with OS X. So, once in a while Maven stops working, whereupon I re-create the symlink to Maven 2.
Today, though, it kept refusing to work after recreating the symlink, giving the following complaint:
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher Caused by: java.lang.ClassNotFoundException: org.codehaus.classworlds.Launcher at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
After some digging, Apple apparently decided to add the M2_HOME environment variable to /etc/launchd.conf (although why is a good question, taking into account that they’re trying to get you to use Maven 3), overriding the value in my envrionment.plist file. Deleting the line from launchd.conf solved the issue, eventually.