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

Build failed with dependency exception

Open pierrickrouxel opened this issue 5 months ago • 1 comments

On a project with internal Gradle module dependencies, the generateOpenApiDocs fails with the following message.

> Task :apps:private-api:forkedSpringBootRun FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':xxx:forkedSpringBootRun' (type 'JavaExecFork').
  - Gradle detected a problem with the following location: 'xxx/xxx.jar'.
    
    Reason: Task ':xxx:forkedSpringBootRun' uses this output of task ':xxx:jar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

The problem appears only on the first generation after a clean task, so the problem breaks the CI.

It seems to come from a missing dependency with the task assemble.

pierrickrouxel avatar Jun 16 '25 07:06 pierrickrouxel

A workaround is to add the following config to your build.gradle.

tasks.named('forkedSpringBootRun') {
  dependsOn('assemble')
}

pierrickrouxel avatar Jun 16 '25 07:06 pierrickrouxel