Skip to content

CI - Groovy Joint Validation Build is broken: spock-core:2.4-groovy-5.0 incompatible with Groovy 4.x snapshot #15613

@jamesfredley

Description

@jamesfredley

Summary

The CI - Groovy Joint Validation Build workflow (build_grails job) has been failing on every push to 8.0.x since 2026-04-29 with a Spock vs. Groovy major-version mismatch:

> Task :grails-test-examples-issue-11767:compileIntegrationTestGroovy
startup failed:

Could not instantiate global transform class
org.spockframework.compiler.SpockTransform specified at
jar:file:.../spock-core/2.4-groovy-5.0/.../spock-core-2.4-groovy-5.0.jar!/META-INF/services/...
because of exception
org.spockframework.util.IncompatibleGroovyVersionException:
The Spock compiler plugin cannot execute because Spock 2.4.0-groovy-5.0
is not compatible with Groovy 4.0.32-SNAPSHOT.

Spock artifact: file:.../spock-core-2.4-groovy-5.0.jar
Groovy artifact: file:.../groovy-4.0.32-SNAPSHOT.jar

> Task :grails-test-examples-issue-11767:compileIntegrationTestGroovy FAILED
> Task :grails-test-examples-micronaut:compileIntegrationTestGroovy FAILED

Affected runs (10 most recent 8.0.x runs of the workflow)

Run Commit Result
25144143636 7cf1d19 failure
25134285481 1b33cf8 failure
25086923954 7174dd2 failure
25086897319 919802e failure
25082518134 6e4c6a3 failure

The same failure is reproduced on every PR that merges latest 8.0.x (e.g. PR #15467 / run 25170545059).

Root cause

Commit ae7ee513ec (Override spock to match the micronaut bom's version) bumped the Spock artifact to spock-core:2.4-groovy-5.0 because the Micronaut BOM moved to Groovy 5. spock-core:2.4-groovy-5.0 ships an AST-transform with a hard-coded major-version check that rejects Groovy 4.x at compile time.

The Joint Validation Build (.github/workflows/groovy-joint-workflow.yml) deliberately swaps the Groovy artifact to the Apache Groovy 4.x main snapshot (currently 4.0.32-SNAPSHOT) so we catch breakages before Groovy ships them. With the Spock-5 artifact pinned in the BOM, every Spock spec compiled in the joint build now fails the version check.

Existing precedent

Commit 5d71eb4035 (fix(forge): bypass Spock Groovy-version check in generated app build.gradle) already adopted Spock's documented escape hatch for forge-generated apps:

tasks.withType(GroovyCompile).configureEach {
    options.forkOptions.jvmArgs = (options.forkOptions.jvmArgs ?: []) +
        ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}
tasks.withType(Test).configureEach {
    systemProperty 'spock.iKnowWhatImDoing.disableGroovyVersionCheck', 'true'
}

The same workaround was not applied to the grails-core build itself. grep -r 'disableGroovyVersionCheck' origin/8.0.x returns nothing on the framework build files - only the rocker template carries it.

Suggested options (please pick one)

  1. Apply the existing forge bypass to the framework build. Add -Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true to the shared compile/test conventions used by the test-examples and the grails-core integration-test compile classpaths (gradle/test-config.gradle, build-logic/.../CompilePlugin.groovy). Lowest-risk: matches what the forge templates already do, restores the joint build immediately.
  2. Publish or pin a Groovy-4-compatible Spock alongside the Groovy-5 one. Use a Gradle resolution rule (or a spock.version override) so when groovy.version resolves to 4.x the dependency picks spock-core:2.3-groovy-4.0 (already on the classpath) instead of 2.4-groovy-5.0. Keeps the framework on a sanctioned Spock build for the Joint matrix; requires more BOM logic.
  3. Drop the Joint Groovy 4 matrix. If the project is consciously moving to Groovy 5 for 8.0.x, retire the joint validation against apache/groovy:GROOVY_4_0_X and validate against the 5.x main only.

Repro

./gradlew :grails-test-examples-issue-11767:compileIntegrationTestGroovy

with the local Maven repo populated by mvn install -P -groovydoc,jaxb,asciidoctor,nodoc -DskipTests from the apache/groovy 4.0.x branch (mirroring what the workflow does).

Related

cc @jamesfredley @jdaugherty

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions