-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build fails when running the api generation during a publish task. #120
Comments
Read the docs please: For spring-boot: 3x use |
@bnasslahsen sry I forgot to update that version when I copied it over from another issue. We are using I updated the description. Could you please open the issue again. |
Please provide the demo project that shows the issue. |
Signed-off-by: Clemens Grabmann <[email protected]>
Signed-off-by: Clemens Grabmann <[email protected]>
@bnasslahsen I created the test repo, you can find it here: Running the |
Seems I was able to get around some of the dependsOn warnings in my plugin with this: project.extensions.configure(OpenApiExtension::class.java) {
it.customBootRun.workingDir.set(
tasks.named("forkedSpringBootRun").get().temporaryDir
)
} |
The workaround here works! It would be better to fix it though. |
@bnasslahsen I opened a PR to resolve, please have a look. Thank you |
I confirm that @hesselapplications's workaround works. I used a simpler configuration: openApi {
customBootRun {
workingDir = file(layout.buildDirectory).createTempDir()
}
} |
Issue #120 fix - set fork working dir to temp dir
TLDR: As described here the build fails while running the api generation during a publish task.
Version Information:
Springdoc-openapi-gradle-plugin: 1.7.0
springdoc: 2.1.0
spring-boot: 3.0.6
Gradle: 8.2.1 (using kotlin)
We are using your plugin within our own
autoconfigure-gradle-plugin
to apply some default configuration if someone wants to use your plugin to generate the openapi-spec. This works great as long as you only use thegenerateOpenApiDocs
task directly. But if you hook it into the publish chain (tasks.named("publish").dependsOn("generateOpenApiDocs")
(most likely also when hooking it into the build chain) the whole build fails with something like:The underlying problem seems to be that the
gradle-execfork-plugin
defines the working directory as@InputDirectory
causing Gradle to track all files in the project (also in the build directory) as inputs to the task and therefore failing the build, since the tasks generating these files are not explicitly depended upon.There already exists a bug report for this here, but nothing happened since March.
I don't know what the best course of action for your plugin would be. I would see 2 options:
Things I'm currently trying for our plugin:
forkedSpringBootRun
task to some dummy directory: this seems a bit tricky since the way I'm creating the directory introduces a lot of additional task dependencies for no apparent reason. And its hard to tell which tasks will use a specific directory during configuration time (especially since the user can still change everything)forkedSpringBootRun
task: this would work, but also disables Gradle task caching for this, which is undesirable since it significantly increases the build time even if not necessary.If required I can create a demo project for you that illustrates the issue.
The text was updated successfully, but these errors were encountered: