Skip to content

Commit 60a8252

Browse files
committed
Use the bootRun javaLauncher in fork task
Verified in a new Spring initializer project (plus springdoc and plugin) for both Java and Kotlin. For Java, choose Java 24 as toolchain version in build.gradle but configure Gradle JVM to Java 23 or earlier. For Kotlin, use Java 21 as bytecode version, but for illustrative purposes, downgrade Gradle JVM to Java 19 for example. LinkageError, java.lang.UnsupportedClassVersionError occurs in forkedSpringBootRun task in both cases (but with different encountered versus supported class file versions)
1 parent 0b20fe3 commit 60a8252

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/kotlin/org/springdoc/openapi/gradle/plugin/OpenApiGradlePlugin.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ open class OpenApiGradlePlugin : Plugin<Project> {
110110
?: bootRun.jvmArgs
111111
environment = customBootRun.environment.orNull?.takeIf { it.isNotEmpty() }
112112
?: bootRun.environment
113+
114+
// Respect javaLauncher configured for bootRun, so Gradle JVM version
115+
// (which may differ) is not used.
116+
javaLauncher.set(bootRun.javaLauncher)
117+
113118
if (Jvm.current().toString().startsWith("1.8")) {
114119
killDescendants = false
115120
}

0 commit comments

Comments
 (0)