spockspock-reportsjenkins-spock

java.lang.AbstractMethodError in implementing Spock-Reports Extension (renatoathaydes) for my SPOCK test


I'm very new to SPOCK so excuse me if this a silly question. I've done report setup in my Maven based Spock-Groovy project as mentioned in the below git-hub project- https://github.com/renatoathaydes/spock-reports

What I've done is-

  1. Added below 3 Mvn Dependencies to my POM:

    com.athaydes spock-reports 2.0-RC2 test * * org.slf4j slf4j-api 1.7.30 test org.slf4j slf4j-simple 1.7.30 test
  2. Added report Config.groovy to src/test/groovy path as below-

    spockReports { // set all properties at once set( [ 'com.athaydes.spockframework.report.showCodeBlocks': true, 'com.athaydes.spockframework.report.outputDir': 'target/spock-reports' ] ) }

Now as per above git instruction results should be generated with index.html in my target/spock-reports directory but I'm getting below exception while running the test. Not able to understand what shall I do to fix this error!

I've also tried by changing to latest versions of above dependencies i.e.- 2.0.0-alpha1, but no help :( Note: However everything was working fine before above two changes.

Exception in thread "main" java.lang.AbstractMethodError: Receiver class com.athaydes.spockframework.report.internal.SpockReportsConfiguration does not define or inherit an implementation of the resolved method abstract getProperty(Ljava/lang/String;)Ljava/lang/Object; of interface groovy.lang.GroovyObject. at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:190) at groovy.lang.Closure.getPropertyTryThese(Closure.java:313) at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:307) at groovy.lang.Closure.getProperty(Closure.java:296) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:309)

Any help will be highly appreciated. Thanks in Advance.


Solution

  • I surprisingly got it working today, by changing versions to the older stable (1.7.1) for spock-reports and latest one: '2.0.0-alpha1' for - slf4j dependencies.

    <dependency>
      <groupId>com.athaydes</groupId>
      <artifactId>spock-reports</artifactId>
      <version>1.7.1</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.0-alpha1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>2.0.0-alpha1</version>
      <scope>test</scope>
    </dependency>