Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 437 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin

#1
I got a maven spring project but when I try to run it, I can't... some idea about it...
The next is the Error Message:

BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.532s
Finished at: Wed Jul 26 16:04:06 COT 2017
Final Memory: 17M/196M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce
(enforce-versions) on project SIMI: Some Enforcer rules have failed. Look above for
specific messages explaining why the rule failed. -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1]

[To see links please register here]

Reply

#2
one thing that may cause this problem is that in your project in a POM file required java or maven version is set. you should find it... but how ?
maybe you couldn't find any enforcer in your project like me ...
(I had the same problem and I became confused because enforcer plugin was not defined in my projects POMs, so I couldn't find it).

enforcer plugin is in your **"effective pom"** and you should check it.
**Effective pom** is a configuration file made from super pom + project pom.
maven use this configuration file to execute the relevant goal. It helps developers to specify minimum configuration detail in his/her pom.xml. Although configurations can be overridden easily.

For showing your effective pom there are 2 ways:
1- use maven command, run this command :

mvn help:effective-pom

2- use your IDE : in Maven window right click on your project node and select show effective POM(it depends on your IDE).

after you find what your forces are you can find it in your project and change it.
for me, My **effective POM** had enforcer plugin which its requireMavenVersion rule for using Java was 1.8. so I changed my project JDK version to 1.8 and luckily the problem was solved.


I hope this answer could help you.
Reply

#3
If you are using version `1.4.1` of `maven-enforcer-plugin` and it is resulting in this error then you need to use an older version of `maven-enforcer-plugin`. You can find the Maven dependency below :

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
</plugin>

Other versions can be found from the link below.

[To see links please register here]


Also, check your Maven version. If you are using `maven 3.0.x` then you need to use `maven-enforcer-plugin 1.4.1`.

Reply

#4
It is possible that someone is enforcing a specific Maven version.

If you see the following message:

> [WARNING] Rule 0:
> org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
> Detected Maven Version: 3.5.4 is not in the allowed range [3.5.2,3.5.2].

Then change your maven installation to the something in the specified range.
In this example, only version 3.5.2 is allowed.
Reply

#5
I faced the same issue and resolved it by fixing the pom versions. Below command didn't run properly on all the sub pom's which resulted in different pom versions.
'mvn versions:set -DnewVersion=${NEW_VERSION} versions:commit'
Check whether all the moms have same version if there is dependent pom's.
Reply

#6
I had this problem because Java (java) was version 8 and the Java compiler (javac) was version 11.

This is typical for Windows users, if you need to switch between versions manually.

Please check the versions first:

```
java -version
javac -version
```

If an IDE is used, for example an IntelliJ Idea, then I will advise to carefully study the project settings as well. Perhaps it makes sense to completely delete the files generated by the IDE and import the project again.
Reply

#7
After doing some research found an answer for this .if your using IntelliJ

```Go to Settings ---> builds --> Maven -->set the Maven home directory.```

[![enter image description here][1]][1]


[1]:
Reply

#8
I faced this issue. Its because of the maven binary version used.

I have used maven 3.0.3 version. and the enforcer plugin wasn't reliable with that. So changed the maven binary to latest 3.6.3. And the issue got resolved and working awesome.
Reply

#9
Firslty go tto project and run mvn clean , if build is success then just check whether the required dependency is downloaded in your .m2 folder or not , If dependency does not get downloaded in your local .m2 folder , it means either version number is incorrect for that dependency or artifactory path is not correct

Else if mvn clean itself fails while dependency exist in your .m2 folder , means yoru settings.xml file actually got corrupted
Reply

#10
This worked for me.

mvn clean
mvn clean install
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through