Java 检测到 Maven 版本:3.0.5 不在允许范围内 3.2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31968515/
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
Detected Maven Version: 3.0.5 is not in the allowed range 3.2
提问by Jaime Irazabal Gonzalez
I am working with Maven and I am getting errors with compiling and building my project. It is the jpmml-project to evaluate some pmml file. Now I got this error:
我正在使用 Maven,但在编译和构建我的项目时遇到错误。评估一些 pmml 文件是 jpmml 项目。现在我收到了这个错误:
Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message: Detected Maven Version: 3.0.5 is not in the allowed range 3.2.
规则 0:org.apache.maven.plugins.enforcer.RequireMavenVersion 失败并显示消息:Detected Maven Version: 3.0.5 is not in the allowed range 3.2.
Check the link to see the image: https://www.dropbox.com/s/3r9d8g8l4r1zctp/maven_error.png?dl=0
检查链接以查看图像:https: //www.dropbox.com/s/3r9d8g8l4r1zctp/maven_error.png?dl=0
Please help! I do not have too much experience with Java and Maven.
请帮忙!我对 Java 和 Maven 没有太多经验。
回答by nfechner
Your pom.xml
contains a plugin called enforcer, that can define a required maven version. You need to install the mentioned maven version (3.2.*) and use it to compile the project.
您pom.xml
包含一个名为执行器的插件,它可以定义所需的 Maven 版本。您需要安装提到的 maven 版本 (3.2.*) 并使用它来编译项目。
回答by Javy
The error
means that your maven
version is too old, you should upgrade your maven version to be grater than 3.2
The error
意味着您的maven
版本太旧,您应该升级您的maven版本以大于3.2
The maven download link
maven 下载链接
http://maven.apache.org/download.cgi
http://maven.apache.org/download.cgi
then clean & compile
然后清理并编译
回答by khmarbaise
Whoever is maintaining this project should think about using an enforcer rule like this. Usually you say you need at least Maven 3.1.1 or higher but never bind to a fixed version. Apart from that Version 3.2 of Maven does not exist...3.2.1 is first 3.2.X release.
维护这个项目的人应该考虑使用这样的执行者规则。通常你说你至少需要 Maven 3.1.1 或更高版本,但从不绑定到固定版本。除此之外,Maven 3.2 版不存在...... 3.2.1 是第一个 3.2.X 版本。
回答by ariabele
Go to Window > Preferences > Maven > Installations
转到窗口 > 首选项 > Maven > 安装
Under Installation you will notice that the embedded version is 3.0.5
在安装下,您会注意到嵌入式版本是 3.0.5
Add a new installation for 3.2
为 3.2 添加新安装
- Click Add
- Navigate to your maven 3.2 installation
- 点击添加
- 导航到您的 maven 3.2 安装
回答by Yumi Koizumi
In intelliJ 2016.1.2 on Ubuntu 16.04:
在 Ubuntu 16.04 上的 IntelliJ 2016.1.2 中:
I had installed the latest with: sudo apt-get install maven
我已经安装了最新的: sudo apt-get install maven
Then just dig down to where IntelliJ hides which maven it will use:
然后深入到 IntelliJ 隐藏它将使用哪个 maven 的位置:
File >
Settings >
Build, Execution, Deployment >
Build Tools >
Maven >
Maven_home directory (I didn't have this env variable set, so you can choose):
-Bundled (Maven 2)
-Bundled (Maven 3) (was the 3.0.5 and it was chosen)
-/usr/share/maven <--- where the newly downloaded maven lives (3.3.9)
-Bundled (Maven 2)
-Bundled (Maven 3)(是 3.0.5 并且它被选中)
-/usr/share/maven <--- 新下载的 maven 所在的位置 (3.3.9)
I could have probably saved a little time and made a /etc/profile.d/maven.shfile and defined:
我本可以节省一点时间并创建一个/etc/profile.d/maven.sh文件并定义:
export MAVEN_HOME=/usr/share/mavenafter installing the latest with apt...
使用 apt 安装最新版本后导出 MAVEN_HOME=/usr/share/maven...
回答by Khaled
- Install latest version of Maven from http://maven.apache.org
If you are using Netbean IDEthen go to Tools -> Options -> Java -> Maven and just configure the installation path as bellow
Open your maven project in Netbeans and build it with dependencies.
- 从http://maven.apache.org安装最新版本的 Maven
如果您使用的是Netbean IDE,请转到 Tools -> Options -> Java -> Maven 并将安装路径配置如下
在 Netbeans 中打开您的 Maven 项目并使用依赖项构建它。
回答by Alexander Samoylov
In case you can't or don't want to update Maven due to some reason but urgently need the build results there is also a way to bypass this check using the command line option:
如果您由于某种原因不能或不想更新 Maven 但迫切需要构建结果,还有一种方法可以使用命令行选项绕过此检查:
-Denforcer.skip=true
It worked for me for Maven 3.0.4 and maven-enforcer-plugin 3.0.0-M1. Since you did not mention in your question if you need just to complete the build or complete it making the enforcer stage fixed, I propose this workaround as an answer as well.
它适用于 Maven 3.0.4 和 maven-enforcer-plugin 3.0.0-M1。由于您没有在问题中提到您是否只需要完成构建或完成它以修复执行器阶段,因此我也建议将此解决方法作为答案。