Detected Maven Version: 3.0.5 is not in the allowed range 3.2
Asked Answered
P

7

17

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.

Polemic answered 12/8, 2015 at 14:45 Comment(2)
Type mvn -version from a command prompt. What version of Maven are you running?Vested
This is because of an old maven-version. See this answer: Codehouse shutdownAcotyledon
C
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.

Caulfield answered 12/8, 2015 at 14:50 Comment(0)
T
11

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.

Thrippence answered 9/6, 2019 at 12:41 Comment(2)
Very handy when you're in a rush just for testing, thanks.Anopheles
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 commandHeedless
L
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...

Lewie answered 6/6, 2016 at 2:14 Comment(0)
C
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

Cervin answered 12/8, 2015 at 14:53 Comment(2)
Actually, because this is an enforcer error, you need to use specifically 3.2, as newer versions won't pass the rule either.Caulfield
Works fine with Maven 3.3.3. Is my computer broken or something?Mikol
L
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
Leeland answered 7/1, 2016 at 1:2 Comment(0)
S
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.

Schizo answered 9/3, 2017 at 20:18 Comment(0)
F
-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.

Faucet answered 12/8, 2015 at 15:58 Comment(3)
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 maven.apache.org/enforcer/enforcer-rules/…Mikol
Based on the error message it says something different.Faucet
Please elaborate. Over here, 3.0 is less than 3.2, which is the minimal supported versionMikol

© 2022 - 2024 — McMap. All rights reserved.