Skip to content
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

[Question] How to hook up generateOpenApiDocs to build task? #127

Open
kkocel opened this issue Aug 23, 2023 · 3 comments
Open

[Question] How to hook up generateOpenApiDocs to build task? #127

kkocel opened this issue Aug 23, 2023 · 3 comments

Comments

@kkocel
Copy link

kkocel commented Aug 23, 2023

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.

@kkocel
Copy link
Author

kkocel commented Aug 29, 2023

Repository with reproduction - https://github.com/kkocel/openapigradlerepro

@LaFrimousse
Copy link

LaFrimousse commented Feb 4, 2024

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

@pratikjain227
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants