使用Maven和IntelliJ,“-Dmaven.multiModuleProjectDirectory未设置”问题 [英] `-Dmaven.multiModuleProjectDirectory not set` issue with Maven and IntelliJ

查看:443
本文介绍了使用Maven和IntelliJ,“-Dmaven.multiModuleProjectDirectory未设置”问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很长时间试图弄清楚我做错了什么,并希望有人可以提供帮助。

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

我目前的设置是运行Maven 3.3.3(通过自制软件)和Java 1.8。 IntelliJ 13是首选的IDE。

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

运行 mvn -version 会产生以下结果:

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"

我相信一切正常,但是当我转到我的IDE并尝试运行Maven项目我收到此错误:

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

我的M2_HOME var设置为 /usr/local/Cellar/maven/3.3.3/libexec ,与自制软件安装它的目录相同,这也与IDE设置相匹配。

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.

一次搜索让我相信它可能与Maven版本和IDE有关,但我不相信。请问有人可以对此有所了解吗?

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?

推荐答案

如果您再次遇到该错误,请转到设置 - > Maven - >亚军并添加

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

-Dmaven.multiModuleProjectDirectory=$M2_HOME

到VM选项。

这篇关于使用Maven和IntelliJ,“-Dmaven.multiModuleProjectDirectory未设置”问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆