简体   繁体   English

检测到的Maven版本:3.0.5不在允许的范围内3.2

[英]Detected Maven Version: 3.0.5 is not in the allowed range 3.2

I am working with Maven and I am getting errors with compiling and building my project. 我正在使用Maven,我在编译和构建项目时遇到错误。 It is the jpmml-project to evaluate some pmml file. 这是评估一些pmml文件的jpmml项目。 Now I got this error: 现在我收到了这个错误:

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不在允许的范围内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没有太多经验。

Your pom.xml contains a plugin called enforcer , that can define a required maven version . 您的pom.xml包含一个名为enforcer的插件,可以定义所需的maven版本 You need to install the mentioned maven version (3.2.*) and use it to compile the project. 您需要安装提到的maven版本(3.2。*)并使用它来编译项目。

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 2)
-Bundled (Maven 3) (was the 3.0.5 and it was chosen) -Bundled(Maven 3)(是3.0.5,它被选中)
-/usr/share/maven <--- where the newly downloaded maven lives (3.3.9) - / usr / share / maven <---新下载的maven住的地方(3.3.9)

I could have probably saved a little time and made a /etc/profile.d/maven.sh file and defined: 我本可以节省一点时间并制作一个/etc/profile.d/maven.sh文件并定义:

export MAVEN_HOME=/usr/share/maven after installing the latest with apt... 安装最新的apt后导出MAVEN_HOME = / usr / share / maven ...

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 然后清理和编译

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安装
  • Install latest version of Maven from http://maven.apache.org http://maven.apache.org安装最新版本的Maven
  • If you are using Netbean IDE then go to Tools -> Options -> Java -> Maven and just configure the installation path as bellow 如果您使用的是Netbean IDE,请转到工具 - >选项 - > Java - > Maven,然后将安装路径配置为如下

    在此输入图像描述

  • Open your maven project in Netbeans and build it with dependencies. 在Netbeans中打开maven项目并使用依赖项构建它。

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. 它适用于Maven 3.0.4和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. 由于你没有在你的问题中提到你是否只需要完成构建或完成它以使修正阶段得到修复,我也建议将此解决方案作为答案。

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. 通常你说你至少需要Maven 3.1.1或更高版本,但永远不会绑定到固定版本。 Apart from that Version 3.2 of Maven does not exist...3.2.1 is first 3.2.X release. 除了版本3.2的Maven不存在... 3.2.1是第一个3.2.X发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM