注意事項
不能同時設M2_HOME與M3_HOME兩個環境變數, 不然執行maven會出現以下的exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.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:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
参考:http://cb.esast.com/cb/wiki/22945Installing Maven 3 on OS X
1. Install Mac Ports
2. Install Maven 3
Open a terminal and type the following:
sudo port install maven3 maven_select
sudo maven_select maven3