Skip to content

Commit 3c3aa9e

Browse files
committed
Merge branch '2.3.x' into 2.4.x
Closes gh-24735
2 parents 097f878 + 064de4e commit 3c3aa9e

File tree

1 file changed

+12
-1
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run

1 file changed

+12
-1
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,10 +21,12 @@
2121
import java.util.Set;
2222

2323
import org.gradle.api.file.SourceDirectorySet;
24+
import org.gradle.api.provider.Property;
2425
import org.gradle.api.tasks.Input;
2526
import org.gradle.api.tasks.JavaExec;
2627
import org.gradle.api.tasks.SourceSet;
2728
import org.gradle.api.tasks.SourceSetOutput;
29+
import org.gradle.jvm.toolchain.JavaLauncher;
2830

2931
/**
3032
* Custom {@link JavaExec} task for running a Spring Boot application.
@@ -87,6 +89,15 @@ public void exec() {
8789
}
8890

8991
private boolean isJava13OrLater() {
92+
try {
93+
Property<JavaLauncher> javaLauncher = this.getJavaLauncher();
94+
if (javaLauncher.isPresent()) {
95+
return javaLauncher.get().getMetadata().getLanguageVersion().asInt() >= 13;
96+
}
97+
}
98+
catch (NoSuchMethodError ex) {
99+
// Continue
100+
}
90101
for (Method method : String.class.getMethods()) {
91102
if (method.getName().equals("stripIndent")) {
92103
return true;

0 commit comments

Comments
 (0)