Failed to execute goal for Java JUnit project

While executing a newly created JUnit project in QAS via terminal, the user may face an error “Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0“ in the console logs as shown below.

Root Cause: The current version of org.codehaus.mojo version 1.0-beta-7 has been deprecated for Java version 1.8.221 and above.

Solution: Follow the below steps to resolve this issue:

  • Go to the POM.xml file.

  • Navigate to the below code block:

  • Change the org.codehaus.mojo version from 1.0-beta-7 to 1.4 as shown below:

     

  • Save the above changes and execute your project.