Maven 2 on OS X Snow Leopard killed by latest update

Shai Yallin | June 18th 2012 | System

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.


Tags: , ,
By Shai Yallin
A seasoned software engineer focusing on JVM-based languages like Java and Scala; An avid advocate of clean code, continuous delivery and TDD.
Wix

Leave a Reply

We are always looking for excellent people. Browse Jobs Here   

At Wix Engineering we develop some of the most innovative cloud-based web applications that influence our 80+ million users worldwide.

Have any questions? Email academy@wix.com.

Find out what’s coming up at Wix Engineering:

Subscribe to our newsletter for updates, events and more.