Skip to content

GenerateJavaTask breaks Gradle configuration cache in 8.4.1 (regression from #918) #933

@mrmegapolys

Description

@mrmegapolys

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

  1. Enable Gradle configuration cache (org.gradle.configuration-cache=true in gradle.properties)
  2. Apply the DGS codegen plugin v8.4.1
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions