Tomer Lichtash
Tomer Lichtash

Reputation: 9262

How to run IntelliJ and Maven on OS X?

I've got Maven to respond on IntelliJ (all env vars are set); but still -- the following error occurs:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dclassworlds.conf=/usr/local/Cellar/maven/3.0.2/bin/m2.conf -Dmaven.home=/usr/local/Cellar/maven/3.0.2 -Dfile.encoding=MacRoman -classpath org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --no-plugin-updates --strict-checksums --update-snapshots -f /Users/konzepz/Sites/wix/html/Express/pom.xml compile 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:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Process finished with exit code 1

Any ideas?

Thanks!

Upvotes: 2

Views: 7144

Answers (4)

bsam
bsam

Reputation: 1928

I could get it to work only by setting IntelliJ IDEA -> Preference -> Maven -> Maven home Directory to "/usr/local/Cellar/maven2/2.2.1/libexec"

Upvotes: 9

mlo55
mlo55

Reputation: 6915

I followed the instructions (paraphrased below) from Vladimir Krivosheev in http://youtrack.jetbrains.net/issue/IDEA-21225 ... hope it helps


  • create a new .MacOSX folder in your home folder (if it doesn't already exist)
  • create a new environment.plist in the .MacOSX folder (with the following contents... change the path to match the folder that you installed maven into)

    {
    "M2_HOME"="/usr/local/maven/apache-maven-3.0.0";
    M2 = "/usr/local/maven/apache-maven-3.0.0/bin";
    

    }

logout of your account and then sign back in

EDIT - 20140827

FYI - Since answering this question, it appears that mavericks no longer supports the environment.plist method, see further details here...https://apple.stackexchange.com/a/125066/40942

I've had success in mavericks using the solution posted here https://superuser.com/a/390926/70256

...which involves opening the intellij preferences --> path variables and adding in the M2_HOME variable with the correct value for you environment.

Upvotes: 2

Ali
Ali

Reputation: 949

In case you don't want to use the M2_HOME and want to direct the IntelliJ to the maven installation you can simply set it by:

  • goto File => Setting => Maven => Maven home directory
  • point to your maven build directory e.g. /usr/local/maven/apache-maven-3.0.4

A better way is to have a symlink e.g. 'latest' for the latest version and point your IntelliJ to use that for consistency, given latest points to the latest version of maven installed on your box.

Upvotes: 0

Raghuram
Raghuram

Reputation: 52665

Can you replace maven.home with MAVEN_HOME and see if the error persists?

Upvotes: 0

Related Questions