Description
GenerateJavaTask accesses Task.project at execution time via JacksonVersionDetector.detectVersions(project) in the @TaskAction generate() method. This was introduced in #918 (v8.4.1) and breaks Gradle configuration cache.
Works on 8.3.0, broken on 8.4.1.
How to Reproduce
- Enable Gradle configuration cache (
org.gradle.configuration-cache=true in gradle.properties)
- Apply the DGS codegen plugin v8.4.1
- Run
./gradlew generateJava
Error
Task `:generateJava` of type `com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask`:
invocation of 'Task.project' at execution time is unsupported with the configuration cache.
Root Cause
JacksonVersionDetector.detectVersions(project) resolves project.configurations.findByName("compileClasspath") and iterates resolved artifacts at execution time. The configuration cache requires that Task.project is not accessed during task execution.
This is a regression — the same class of issue was previously fixed in #587.
Environment
- DGS Codegen: 8.3.0 (works) / 8.4.1 (broken)
- Gradle: 9.4.1
- Configuration cache: enabled
Description
GenerateJavaTaskaccessesTask.projectat execution time viaJacksonVersionDetector.detectVersions(project)in the@TaskAction generate()method. This was introduced in #918 (v8.4.1) and breaks Gradle configuration cache.Works on 8.3.0, broken on 8.4.1.
How to Reproduce
org.gradle.configuration-cache=trueingradle.properties)./gradlew generateJavaError
Root Cause
JacksonVersionDetector.detectVersions(project)resolvesproject.configurations.findByName("compileClasspath")and iterates resolved artifacts at execution time. The configuration cache requires thatTask.projectis not accessed during task execution.This is a regression — the same class of issue was previously fixed in #587.
Environment