15

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.

f_puras
  • 2,521
  • 4
  • 33
  • 38

7 Answers7

12

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.

nfechner
  • 17,295
  • 7
  • 45
  • 64
10

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.

Alexander Samoylov
  • 2,358
  • 2
  • 25
  • 28
  • Very handy when you're in a rush just for testing, thanks. – Mehdi LAMRANI Jan 13 '20 at 12:16
  • Saved my time, thank you. I work on couple projects that have different Maven and Java setup, and this option saved me from switching regularly between maven version from environment variables, Very useful command – Cortex Mar 09 '21 at 19:05
7

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...

Yumi Koizumi
  • 331
  • 2
  • 4
  • 12
3

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

Javy
  • 944
  • 5
  • 9
3

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
ariabele
  • 355
  • 1
  • 4
  • 9
1
  • Install latest version of Maven from http://maven.apache.org
  • If you are using Netbean IDE then go to Tools -> Options -> Java -> Maven and just configure the installation path as bellow

    enter image description here

  • Open your maven project in Netbeans and build it with dependencies.

Khaled
  • 255
  • 4
  • 16
-1

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.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • Maven Enforcer Plugin has its own version range syntax, which is more relaxed than the "standard" version range syntax. So, `3.2` is perfectly valid. See http://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html – user1808924 Aug 12 '15 at 17:40
  • Based on the error message it says something different. – khmarbaise Aug 13 '15 at 11:01
  • Please elaborate. Over here, 3.0 is less than 3.2, which is the *minimal* supported version – user1808924 Aug 13 '15 at 18:00