Commit 3c3aa9e4 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.3.x' into 2.4.x

Closes gh-24735
parents 097f8789 064de4e0
/* /*
* Copyright 2012-2020 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -21,10 +21,12 @@ import java.lang.reflect.Method; ...@@ -21,10 +21,12 @@ import java.lang.reflect.Method;
import java.util.Set; import java.util.Set;
import org.gradle.api.file.SourceDirectorySet; import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.JavaExec; import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetOutput; import org.gradle.api.tasks.SourceSetOutput;
import org.gradle.jvm.toolchain.JavaLauncher;
/** /**
* Custom {@link JavaExec} task for running a Spring Boot application. * Custom {@link JavaExec} task for running a Spring Boot application.
...@@ -87,6 +89,15 @@ public class BootRun extends JavaExec { ...@@ -87,6 +89,15 @@ public class BootRun extends JavaExec {
} }
private boolean isJava13OrLater() { private boolean isJava13OrLater() {
try {
Property<JavaLauncher> javaLauncher = this.getJavaLauncher();
if (javaLauncher.isPresent()) {
return javaLauncher.get().getMetadata().getLanguageVersion().asInt() >= 13;
}
}
catch (NoSuchMethodError ex) {
// Continue
}
for (Method method : String.class.getMethods()) { for (Method method : String.class.getMethods()) {
if (method.getName().equals("stripIndent")) { if (method.getName().equals("stripIndent")) {
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment