Support Gradle 7 and raise minimum supported version to 6.8

Closes gh-26026
This commit is contained in:
Andy Wilkinson 2021-04-12 15:14:55 +01:00
parent 8506a00071
commit c4750fd0ff
7 changed files with 13 additions and 14 deletions

View File

@ -23,7 +23,7 @@ Please refer to the plugin's documentation to learn more:
[[build-tool-plugins-gradle-plugin]]
== Spring Boot Gradle Plugin
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, letting you package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by `spring-boot-dependencies`.
It requires Gradle 6 (6.3 or later).
It requires Gradle 6.8 or 7.x.
Please refer to the plugin's documentation to learn more:
* Reference ({spring-boot-gradle-plugin-docs}[HTML] and {spring-boot-gradle-plugin-pdfdocs}[PDF])

View File

@ -41,7 +41,7 @@ Explicit build support is provided for the following build tools:
| 3.3+
| Gradle
| 6 (6.3 or later)
| 6.8.x and 7.x
|===
@ -117,7 +117,7 @@ More details on getting started with Spring Boot and Maven can be found in the {
[[getting-started-gradle-installation]]
==== Gradle Installation
Spring Boot is compatible with Gradle 6 (6.3 or later).
Spring Boot is compatible with Gradle 6.8 and 7.x.
If you do not already have Gradle installed, you can follow the instructions at https://gradle.org.
Spring Boot dependencies can be declared by using the `org.springframework.boot` `group`.

View File

@ -42,8 +42,7 @@ Andy Wilkinson, Scott Frederick
== Introduction
The Spring Boot Gradle Plugin provides Spring Boot support in https://gradle.org[Gradle].
It allows you to package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by `spring-boot-dependencies`.
Spring Boot's Gradle plugin requires Gradle 6 (6.3 or later).
Gradle's {gradle-userguide}/configuration_cache.html[configuration cache] is supported when using Gradle 6.7 or later.
Spring Boot's Gradle plugin requires Gradle 6.8 or 7.x and can be used with Gradle's {gradle-userguide}/configuration_cache.html[configuration cache].
In addition to this user guide, {api-documentation}[API documentation] is also available.

View File

@ -1,6 +1,6 @@
[[managing-dependencies]]
== Managing Dependencies
To manage dependencies in your Spring Boot application, you can either apply the {dependency-management-plugin}[`io.spring.dependency-management`] plugin or, if you are using Gradle 6 or later, use Gradle's native bom support.
To manage dependencies in your Spring Boot application, you can either apply the {dependency-management-plugin}[`io.spring.dependency-management`] plugin or use Gradle's native bom support.
The primary benefit of the former is that it offers property-based customization of managed versions, while using the latter will likely result in faster builds.

View File

@ -95,9 +95,9 @@ public class SpringBootPlugin implements Plugin<Project> {
private void verifyGradleVersion() {
GradleVersion currentVersion = GradleVersion.current();
if (currentVersion.compareTo(GradleVersion.version("6.3")) < 0) {
throw new GradleException("Spring Boot plugin requires Gradle 6 (6.3 or later). "
+ "The current version is " + currentVersion);
if (currentVersion.compareTo(GradleVersion.version("6.8")) < 0) {
throw new GradleException(
"Spring Boot plugin requires Gradle 6.8.x or 7.x. " + "The current version is " + currentVersion);
}
}

View File

@ -51,7 +51,7 @@ final class GradleCompatibilityExtension implements TestTemplateInvocationContex
GRADLE_VERSIONS = Arrays.asList("7.0");
}
else {
GRADLE_VERSIONS = Arrays.asList("6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1", "current", "7.0");
GRADLE_VERSIONS = Arrays.asList("current", "7.0");
}
}
@ -74,7 +74,7 @@ final class GradleCompatibilityExtension implements TestTemplateInvocationContex
List<TestTemplateInvocationContext> invocationContexts = new ArrayList<>();
invocationContexts.add(new GradleVersionTestTemplateInvocationContext(version, false));
boolean configurationCache = gradleCompatibility.configurationCache();
if (configurationCache && GradleVersion.version(version).compareTo(GradleVersion.version("6.7")) >= 0) {
if (configurationCache) {
invocationContexts.add(new GradleVersionTestTemplateInvocationContext(version, true));
}
return invocationContexts.stream();

View File

@ -40,15 +40,15 @@ class SpringBootPluginIntegrationTests {
@DisabledForJreRange(min = JRE.JAVA_14)
@Test
void failFastWithVersionOfGradle6LowerThanRequired() {
BuildResult result = this.gradleBuild.gradleVersion("6.2.2").buildAndFail();
BuildResult result = this.gradleBuild.gradleVersion("6.7.1").buildAndFail();
assertThat(result.getOutput())
.contains("Spring Boot plugin requires Gradle 6 (6.3 or later). The current version is Gradle 6.2.2");
.contains("Spring Boot plugin requires Gradle 6.8.x or 7.x. The current version is Gradle 6.7.1");
}
@DisabledForJreRange(min = JRE.JAVA_16)
@Test
void succeedWithVersionOfGradle6MatchingWithIsRequired() {
this.gradleBuild.gradleVersion("6.3").build();
this.gradleBuild.gradleVersion("6.8").build();
}
}