Search code examples
javaunit-testinggroovymigrationjava-17

Test case in groovy failing while migrating from java 11 to 17


I am getting this error when I am updating java version from 11 to 17.

SpecInternals.SpyImpl:168->SpecInternals.createMockImpl:295->SpecInternals.createMockImpl:305-   
>SpecInternals.createMock:50 » NoClassDefFound Could not initialize class 
org.spockframework.mock.runtime.CglibMockFactory$ConstructorFriendlyEnhancer

I updated to following versions:

  • spock - 2.3-groovy-3.0
  • groovy-all - 3.0.19
  • gmavenplus-plugin - 3.0.2
  • maven-surefire-plugin - 3.2.2
  • cglib-nodep.version - 3.2.9
  • maven-compiler-plugin - 3.9.0
  • jacoco-maven-plugin - 0.8.10

But I am still facing the issue. Please let me know if anyone has come across this error while migrating from java 11 to 17.


Solution

  • I had the same problem; I replaced cglib-nodep by byte-buddy, then the error disappeared.