I’m working on a gradle plugin. I’ve written a spock test for it. With Gradle 6.7 and this configuration:
dependencies {
implementation gradleApi()
testImplementation('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
testImplementation gradleTestKit()
testImplementation 'junit:junit:4.12'
}
it works just fine. With Gradle 7, I get:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/ndw/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/1.3-groovy-2.5/6f0df2cf4549dcc4b914971675da7e224e893e82/spock-core-1.3-groovy-2.5.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 1.3.0-groovy-2.5 is not compatible with Groovy 3.0.7. For more information, see http://versioninfo.spockframework.org
If I upgrade to the latest framework:
testImplementation('org.spockframework:spock-core:2.0-groovy-3.0') {
exclude group: 'org.codehaus.groovy'
}
The error message goes away, but gradle test
doesn’t run any tests. I mean, it claims to:
> Task :compileJava NO-SOURCE
> Task :compileGroovy
> Task :pluginDescriptors
> Task :processResources
> Task :classes
> Task :pluginUnderTestMetadata
> Task :compileTestJava NO-SOURCE
> Task :compileTestGroovy
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
BUILD SUCCESSFUL in 3s
6 actionable tasks: 6 executed
but it doesn’t. There’s no log output here and if I introduce an intentional error in the tests, they still pass. It does appear to be compiling the tests, it just isn’t running them.