You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check configured JavaLauncher when determining version of the JVM
Previously, bootRun assumed that the Java version of the JVM that would
run the application would be the same as the Java version of the JVM
that is running the build. This assumption does not hold true when
Gradle's toolchain support is used to configure tasks that fork a new
JVM to use a version other than that being used by Gradle itself.
This commit updates the BootRun task to query the JavaLauncher property
when determining the version of Java on which the application will be
run. Toolchain support and the JavaLauncher property are new in Gradle
6.7. To support earlier versions of Gradle, NoSuchMethodError is caught
we continue as if no JavaLauncher has been configured and use the local
JVM's Java version.
Fixesgh-24512
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2020 the original author or authors.
2
+
* Copyright 2012-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -19,10 +19,12 @@
19
19
importjava.lang.reflect.Method;
20
20
21
21
importorg.gradle.api.file.SourceDirectorySet;
22
+
importorg.gradle.api.provider.Property;
22
23
importorg.gradle.api.tasks.Input;
23
24
importorg.gradle.api.tasks.JavaExec;
24
25
importorg.gradle.api.tasks.SourceSet;
25
26
importorg.gradle.api.tasks.SourceSetOutput;
27
+
importorg.gradle.jvm.toolchain.JavaLauncher;
26
28
27
29
/**
28
30
* Custom {@link JavaExec} task for running a Spring Boot application.
0 commit comments