springdoc-openapi-gradle-plugin
springdoc-openapi-gradle-plugin copied to clipboard
[Question] How to hook up generateOpenApiDocs to build task?
I would like to have openapi file generated during build time.
When I configure generateOpenApiDocs
to be run after build
:
tasks.named("build") {
finalizedBy("generateOpenApiDocs")
}
I get the following error:
Some problems were found with the configuration of task ':forkedSpringBootRun' (type 'JavaExecFork').
- Gradle detected a problem with the following location: '/Users/user/projects/service/build/classes/java/aot'.
Reason: Task ':forkedSpringBootRun' uses this output of task ':compileAotJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Is there a recommended way to configure this? If so the it could be put in the README.
Repository with reproduction - https://github.com/kkocel/openapigradlerepro
I have a similar issue than @kkocel when attaching the "generateOpenApiDocs" to my gradle build task.
tasks.named("build") {
finalizedBy("generateOpenApiDocs")
}
On my machine, the build fails for the following reasons:
- Reason: Task ':app:forkedSpringBootRun' uses this output of task ':app:compileTestJava' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
- Reason: Task ':app:forkedSpringBootRun' uses this output of task ':app:test' without declaring an explicit or implicit dependency.
- Reason: Task ':app:forkedSpringBootRun' uses this output of task ':app:jar' without declaring an explicit or implicit dependency.
- Reason: Task ':app:forkedSpringBootRun' uses this output of task ':app:bootJar' without declaring an explicit or implicit dependency.
- Reason: Task ':app:forkedSpringBootRun' uses this output of task ':app:generateTestEffectiveLombokConfig' without declaring an explicit or implicit dependency.
I am using the gradle wrapper version 8.6
Is there a working sample for this? Running into bunch of issues with forkedSpringBootRun
when running with Gittlab Ci, but runs fine on the local machine.