0Day Forums
Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: FrameWork (https://zeroday.vip/Forum-FrameWork)
+---- Forum: Spring (https://zeroday.vip/Forum-Spring)
+---- Thread: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin (/Thread-Failed-to-execute-goal-org-apache-maven-plugins-maven-enforcer-plugin)

Pages: 1 2


Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - bookshops868304 - 08-02-2023

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]




RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - gypsywise244641 - 08-02-2023

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.



RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - lou250816 - 08-02-2023

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




RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - shrovetide45 - 08-02-2023

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.


RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - toddqnljoozwb - 08-02-2023

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.


RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - heilbronn919 - 08-02-2023

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.


RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - alphitomancy322108 - 08-02-2023

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]:



RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - willisxoquuaoce - 08-02-2023

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.


RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - flavoprotein471 - 08-02-2023

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



RE: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin - cambreefnmhdptvjg - 08-02-2023

This worked for me.

mvn clean
mvn clean install