Open matthewadams opened 1 year ago
@matthewadams I had the same issue with bootRun not found after upgrading.
In our case our plugins section looked like this:
plugins {
id 'org.springframework.boot' version '2.7.14'
id 'org.springdoc.openapi-gradle-plugin' version '1.7.0'
id 'java'
}
The issue went away when reordering this to
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.14'
id 'org.springdoc.openapi-gradle-plugin' version '1.7.0'
}
So maybe try with kotlin before springboot?
It seems that the openapi plugin now depends on a particular initialization order whereas previously (before 1.7.0) it did not matter. If this behavior change is intentional, it should probably be documented somewhere.
I'm having same issue with version 1.7.0.
id("application")
as first plugin. @nbam-e 's idea about moving Kotlin before Spring Boot also worked for me.id("application")
).Looks like there is a workaround. But it's not working for combination of Spring Boot 2.7.14 & Gradle 8.1.1.
Sure enough, reording like this got rid of the problem:
plugins {
kotlin("jvm") version "1.8.22"
kotlin("plugin.spring") version "1.8.22"
id("org.springframework.boot") version "3.1.2"
id("org.springdoc.openapi-gradle-plugin") version "1.7.0"
id("io.spring.dependency-management") version "1.1.2"
}
This either needs to be identified as a bug and fixed, or at least documented.
Thanks! 🙏🏼
Any update here? Gradle 8
is out for some time, same for SpringBoot 3
, and looks like it's not easy to work with them using springdoc
I guess the fix (at springdoc-openapi-gradle-plugin
side) is
a) Either stop using bootRun
task directly (e.g. here https://github.com/springdoc/springdoc-openapi-gradle-plugin/blob/e855f9c3aeb776f3d3ef285c80aca748c5a50950/src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGradlePlugin.kt#L31-L32). Is the task really helpful?
b) Wait for both org.springframework.boot
and java
plugins, and massage bootRun
only in case both plugins are added (see https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#reacting-to-other-plugins.java ). For instance: plugins.withId("org.springframework.boot") { plugins.withId("java") { massageBootRunTask() } }
Steps to reproduce:
Generate a new Gradle Kotlin Spring Boot project (see settings below) from start.spring.io
Update gradle to 8.3 in
gradle/wrapper/gradle-wrapper.properties
:Add the springdoc plugin to the project:
Issue command
./gradlew generateOpenApiDocs
, observe failure