Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

What is Maven surefire plugin?

The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in two different file formats: Plain text files (*. txt) XML files (*.

How do I fix Mojo failure exception?

Right click on Project-> Properties--> select project facets--> choose Java correct version which is installed on your system. Then it will works fine.

What is org Apache Maven plugins?

org.apache.maven.plugins » maven-javadoc-pluginApache. The Apache Maven Javadoc Plugin is a plugin that uses the javadoc tool for generating javadocs for the specified project. Last Release on Apr 20, 2022.


I had similar issue, I was able to solve it using -U option along with mvn command as

mvn clean install -U

This worked for me, hope it helps.


You're probably missing some dependencies.

Locate the dependencies you're missing with mvn dependency:tree, then install them manually, and build your project with the -o (offline) option.


I had a similar problem but all answers here didn't help me.

For me the problem was a failing test. If you are doing test driven development, then a failing or not implemented test shouldn't break the build. I still want my project to build.

To solve this, I added a configuration to surefire so that it ignores a failing test.

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

This error occurs if some unit test cases are failing.

In my application, certain unit tests were not compatible with Java 8 so they were failing. My error was resolved after changing jdk1.8.0_92 to jdk1.7.0_80.

The build would succeed with mvn clean install -DskipTests but this will skip the unit tests. So just ensure that you run then separately after the build is complete.


Update the Maven project:

Steps:

  1. Right-click on "project"
  2. Go to "Maven" >> "Update"
  3. Wait for all the changes to be applied
  4. Commit the changes (if code is on repo)
  5. Run