Java Maven 3.3.1 ECLIPSE:-Dmaven.multiModuleProjectDirectory 系统属性未设置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29330577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven 3.3.1 ECLIPSE: -Dmaven.multiModuleProjectDirectory system propery is not set
提问by Bob
I just installed Maven 3.3.1 on Mac OS X, and building a Maven Project with Eclipse is giving me this error:
我刚刚在 Mac OS X 上安装了 Maven 3.3.1,并且使用 Eclipse 构建 Maven 项目给了我这个错误:
-Dmaven.multiModuleProjectDirectory system property is not set.
Check $M2_HOME environment variable and mvn script match.
It did not happen before with Maven 3.2.5.
Maven 3.2.5 之前没有发生过这种情况。
Is there any way to fix this (except downgrading to 3.2.5) ?
有没有办法解决这个问题(除了降级到 3.2.5)?
Where exactly can I set this "multiModuleProjectDirectory" property in Eclipse?
在 Eclipse 中,我究竟可以在哪里设置这个“multiModuleProjectDirectory”属性?
采纳答案by Diego Macario
In Eclipse
you need to go like this.
在Eclipse
你需要这样去。
Window-> Preference -> Java -> Installed JREs -> Edit
In the edit Default VM arguments
you need to put
在编辑中,Default VM arguments
您需要放置
If you already set the maven home.
如果您已经设置了 Maven 主页。
-Dmaven.multiModuleProjectDirectory=$M2_HOME
回答by khmarbaise
Define like this in the JVM options:
在 JVM 选项中这样定义:
-Dmaven.multiModuleProjectDirectory=HOME_PATH_OF_YOU_PROJECT
回答by hd84335
go to run configuration, create new maven build
launch configuration where in the first tab you fill the base directory and the goal,
then, go to jre tab
and add to the vm args
this config:
转到运行配置,创建新的maven build
启动配置,在第一个选项卡中填写基本目录和目标,然后转到jre tab
并添加vm args
到此配置:
-Dmaven.multiModuleProjectDirectory=%M2_HOME%
where M2_HOME
is an environment variable pointing to the base directory of your maven installation
M2_HOME
指向 Maven 安装的基本目录的环境变量在哪里
回答by ziesemer
This was filed as a bug with m2e in Eclipse at https://bugs.eclipse.org/bugs/show_bug.cgi?id=462944, due to the changes in Maven 3.3.1.
由于 Maven 3.3.1 中的更改,这在https://bugs.eclipse.org/bugs/show_bug.cgi?id=462944 上作为 Eclipse 中 m2e 的错误提交。
This is fixed in m2e 1.5.2 as of 2015-04-13. This is an available release that can be installed from http://download.eclipse.org/technology/m2e/releases/.
自 2015 年 4 月 13 日起,这已在 m2e 1.5.2 中修复。这是一个可用版本,可以从http://download.eclipse.org/technology/m2e/releases/安装。
(No more changing JVM arguments for the entire workspace or for specific launch configurations required.)
(不再需要更改整个工作区或特定启动配置的 JVM 参数。)
回答by caslaner
If you want to try a second way, you can try to download a path from http://download.eclipse.org/technology/m2e/milestones/1.5/.
如果您想尝试第二种方式,可以尝试从http://download.eclipse.org/technology/m2e/milestones/1.5/下载路径。
Open Help>install new software and download from url above. This way solved my problem.
打开帮助>安装新软件并从上面的网址下载。这种方式解决了我的问题。
回答by gerosalesc
回答by Mohamed Ennahdi El Idrissi
I encountered the same issue with Maven 3.3 and 3.2 versions, so I decided to downgrade it to version 3.0.5 and it worked just fine.
我在 Maven 3.3 和 3.2 版本中遇到了同样的问题,所以我决定将它降级到 3.0.5 版本并且它工作得很好。
回答by Mohamed Ennahdi El Idrissi
i had the same problem with intelliJ 14, i tried out different solutions provided at forums but not worked out. What i did is i completely uninstall intellij and installed intellij 15.0.1 and import the same project then all works fine.
我在 intelliJ 14 上遇到了同样的问题,我尝试了论坛上提供的不同解决方案,但没有解决。我所做的是完全卸载intellij并安装intellij 15.0.1并导入相同的项目然后一切正常。
回答by dvtoever
In case you have this error message on your commandline, please verify if your PATH variable points to the same maven installation apache-maven-3.X.X/bin
folder as your M2_HOME variable. In my case I was mixing up two versions which resulted in this error.
如果您的命令行上出现此错误消息,请验证您的 PATH 变量是否指向与apache-maven-3.X.X/bin
M2_HOME 变量相同的 maven 安装文件夹。在我的情况下,我混合了两个版本,导致了这个错误。
回答by dabla
To set the maven.multiModuleProjectDirectory
property permanently in Maven, I've added a default activated profile which initializes the property with the MAVEN_HOMEenvironment variable in the settings.xml
file. Or you could also alternatively use the M2_HOMEenvironment variable.
为了maven.multiModuleProjectDirectory
在 Maven 中永久设置属性,我添加了一个默认激活的配置文件,它使用文件中的MAVEN_HOME环境变量初始化属性settings.xml
。或者您也可以使用M2_HOME环境变量。
<profile>
<id>my-profile</id>
<properties>
<maven.multiModuleProjectDirectory>${env.MAVEN_HOME}</maven.multiModuleProjectDirectory>
</properties>
</profile>
<activeProfiles>
<activeProfile>my-profile</activeProfile>
</activeProfiles>