springdoc-openapi-gradle-plugin icon indicating copy to clipboard operation
springdoc-openapi-gradle-plugin copied to clipboard

Gradle Plugin incompatible with the gradle Configuration Cache

Open harryjackson opened this issue 3 months ago • 1 comments

Describe the bug

When trying to use the following version

implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.12")

and running the command

./gradlew clean test build --configuration-cache

I get the following errors

3 problems were found storing the configuration cache.
- Task `:service:forkedSpringBootRun` of type `com.github.psxpaul.task.JavaExecFork`: cannot serialize object of type 'org.springdoc.openapi.gradle.plugin.OpenApiGeneratorTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:task_access
- Task `:service:forkedSpringBootRun` of type `com.github.psxpaul.task.JavaExecFork`: cannot serialize object of type 'org.springframework.boot.gradle.tasks.run.BootRun', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:task_access
- Task `:service:forkedSpringBootStop` of type `com.github.psxpaul.task.ExecJoin`: cannot serialize object of type 'com.github.psxpaul.task.JavaExecFork', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:task_access
  • If you are reporting a bug, please help to speed up problem diagnosis by providing as much information as possible:
  • A clear and concise description of what the bug is: the title of an issue is not enough

To Reproduce

Using Gradle 9.0.0

add the following dependency

    implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.12")

Add a Configuration class

@OpenAPIDefinition(info = @Info(title = "Tools service", version = "v1"), servers = {
    @Server(
        url = "{baseIntegrationToolsUrl}"
    )
})
@Configuration
public class ToolsConfiguration {

}

Run the command

./gradlew clean test build --configuration-cache
  • What version of spring-boot you are using?

org.springframework.boot:spring-boot-starter-web:3.4.6

  • What modules and versions of springdoc-openapi are you using?
 implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.12")

harryjackson avatar Sep 05 '25 23:09 harryjackson

This is how I'm working around the issue:

  • springdoc-openapi-starter-webmvc-ui:2.8.13
  • id("org.springdoc.openapi-gradle-plugin") version "1.9.0"
listOf(
    "generateOpenApiDocs",
    "forkedSpringBootRun",
    "forkedSpringBootStop"
).forEach { taskName ->
    tasks.named(taskName) {
        notCompatibleWithConfigurationCache("The springdoc plugin is not compatible with the configuration cache.")
    }
}

kevinm416 avatar Oct 06 '25 16:10 kevinm416