Maven 和 IntelliJ 的 `-Dmaven.multiModuleProjectDirectory not set` 问题 [英] `-Dmaven.multiModuleProjectDirectory not set` issue with Maven and IntelliJ

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

问题描述

我花了很长时间试图找出我做错了什么,并希望有人能够提供帮助.

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 变量设置为 /usr/local/Cellar/maven/3.3.3/libexec,与 homebrew 安装它的目录相同,这也与 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?

推荐答案

万一您再次遇到该错误,请转到 Settings ->Maven ->Runner 并添加

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

-Dmaven.multiModuleProjectDirectory=$M2_HOME

到虚拟机选项.

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

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