Search code examples
eclipsemavensonarqubesonarqube-plugin

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project. while 'Run as Maven test'


I am trying to create my own custom rules for Z PL/SQL Analyzer plugin by Felipebz. For that, I am following this tutorial.

I downloaded the mentioned Github Directory in that tutorial and imported it in Eclipse. Now, when I try to Run it as "Maven test", I get Following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project plsql-custom-rules: There are test failures.

There are some more errors in the log:

[INFO] Running com.company.plsql.ForbiddenDmlCheckTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.284 s <<< FAILURE! - in com.company.plsql.ForbiddenDmlCheckTest
[ERROR] test(com.company.plsql.ForbiddenDmlCheckTest)  Time elapsed: 0.181 s  <<< ERROR!
java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/lang/String;)Lorg/assertj/core/api/AbstractStringAssert;
at com.company.plsql.ForbiddenDmlCheckTest.test(ForbiddenDmlCheckTest.java:10)

Does someone know any solution to this particular problem?


I want to create a jar for testing it in my SonarQube Server. But, before changing anything in the code, I wanted to test it first as it is; because I reckon that there is a sample rule already provided in the downloaded Project template. I can make further changes in the code once I get to test it as a jar file at first place.


Solution

  • As Raphael Alves suggested, I solved it by adding the following dependency to pom.xml

    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.11.1</version>
        <scope>test</scope>
    </dependency>
    

    You might want to check for the latest version of this dependency on Maven Repository