Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`-Dmaven.multiModuleProjectDirectory not set` issue with Maven and IntelliJ

I've spent quite some time trying to figure out what I'm doing wrong and hoping someone may be able to help.

My current setup is running Maven 3.3.3 (via homebrew) and Java 1.8. IntelliJ 13 is the IDE of choice.

Running mvn -version results in the following:

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-
22T12:57:37+01:00)
Maven home: /usr/local/Cellar/maven/3.3.3/libexec
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"

which I believe means everything is OK, but when I go to my IDE and try to run a Maven project I get this error:

/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -Dmaven.home=/usr/local/Cellar/maven/3.3.3/libexec -Dclassworlds.conf=/usr/local/Cellar/maven/3.3.3/libexec/bin/m2.conf -Didea.launcher.port=7539 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/usr/local/Cellar/maven/3.3.3/libexec/boot/plexus-classworlds-2.5.2.jar:/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.3
-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
Process finished with exit code 1

My M2_HOME var is set to /usr/local/Cellar/maven/3.3.3/libexec, the same directory where homebrew installed it, and this also matches the IDE settings.

One search lead me to believe it may be something to do with Maven version and the IDE but I'm not convinced. Can someone please shed some light on this please?

like image 609
null Avatar asked May 01 '15 08:05

null


2 Answers

Just in case you have that error again go to Settings -> Maven -> Runner and add

-Dmaven.multiModuleProjectDirectory=$M2_HOME

to VM Options.

enter image description here

like image 178
Felix Seele Avatar answered Nov 03 '22 12:11

Felix Seele


I had this wired issue while trying to build CAS Overlay Template using Maven. I could resolve it by adding the following environment variable:

MAVEN_OPTS = -Dmaven.multiModuleProjectDirectory
like image 7
Ismail Kattakath Avatar answered Nov 03 '22 13:11

Ismail Kattakath