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:
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.
Check the link to see the image:
https://www.dropbox.com/s/3r9d8g8l4r1zctp/maven_error.png?dl=0
Please help! I do not have too much experience with Java and Maven.
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.
In intelliJ 2016.1.2 on Ubuntu 16.04:
I had installed the latest with:
sudo apt-get install maven
Then just dig down to where IntelliJ hides which maven it will use:
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)
I could have probably saved a little time and made a /etc/profile.d/maven.sh file and defined:
export MAVEN_HOME=/usr/share/maven after installing the latest with apt...
The error
means that your maven
version is too old, you should upgrade your maven version to be grater than 3.2
The maven download link
http://maven.apache.org/download.cgi
then
clean & compile
Go to Window > Preferences > Maven > Installations
Under Installation you will notice that the embedded version is 3.0.5
Add a new installation for 3.2
- Click Add
- Navigate to your maven 3.2 installation
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:
-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.
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.