Friday, 4 October 2019

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.x.test

When you are setting up a project for the first time with maven, you will end up getting the below error. your maven build may not success.

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test

INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.832s
[INFO] Finished at: Fri Oct 04 14:10:27 CDT 2019
[INFO] Final Memory: 40M/320M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project tm: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Unable to load the mojo 'test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.10'. A required class is missing: org.apache.maven.plugin.surefire.SurefirePlugin
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-surefire-plugin:2.10
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy


Even if you try mvn clean install -U or force update the maven will not solve the problem . The issue will be mostly with the dependency maven-surefire-plugin, you might be using .

Update you maven dependency for maven-surefire-plugin as below, it will solve your problem .

 <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19.1</version>
        </plugin>

Then build your project, it will solve your problem.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.825s
[INFO] Finished at: Fri Oct 04 14:15:44 CDT 2019
[INFO] Final Memory: 44M/369M
[INFO] ------------------------------------------------------------------------



Hope this solves your problem .


No comments:

Post a Comment