From fb670ee654099f1c1147171349d5d17e02a75893 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 19 Mar 2021 17:30:27 +0000 Subject: [PATCH] Drop support for Gradle 5.6.x Closes gh-24225 --- .../src/docs/asciidoc/build-tool-plugins.adoc | 1 - .../src/docs/asciidoc/getting-started.adoc | 1 - .../src/docs/asciidoc/index.adoc | 1 - .../boot/gradle/plugin/SpringBootPlugin.java | 6 ++-- .../junit/GradleCompatibilityExtension.java | 16 ++------- .../SpringBootPluginIntegrationTests.java | 35 ++----------------- 6 files changed, 6 insertions(+), 54 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/build-tool-plugins.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/build-tool-plugins.adoc index 2b086d1dc3..e74180aa14 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/build-tool-plugins.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/build-tool-plugins.adoc @@ -24,7 +24,6 @@ Please refer to the plugin's documentation to learn more: == 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). -Gradle 5.6.x is also supported but this support is deprecated and will be removed in a future release. Please refer to the plugin's documentation to learn more: * Reference ({spring-boot-gradle-plugin-docs}[HTML] and {spring-boot-gradle-plugin-pdfdocs}[PDF]) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/getting-started.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/getting-started.adoc index 2bdf28b95a..f300c47144 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/getting-started.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/getting-started.adoc @@ -118,7 +118,6 @@ 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). -Gradle 5.6.x is also supported but this support is deprecated and will be removed in a future release. 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`. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/index.adoc b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/index.adoc index cf15a83513..96de9cf313 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/index.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/index.adoc @@ -42,7 +42,6 @@ Andy Wilkinson, Scott Frederick 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 5.6 is also supported but this support is deprecated and will be removed in a future release. Gradle's {gradle-userguide}/configuration_cache.html[configuration cache] is supported when using Gradle 6.7 or later. In addition to this user guide, {api-documentation}[API documentation] is also available. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java index fbcd2941bb..9f6d6e3d94 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java @@ -95,10 +95,8 @@ public class SpringBootPlugin implements Plugin { private void verifyGradleVersion() { GradleVersion currentVersion = GradleVersion.current(); - if (currentVersion.compareTo(GradleVersion.version("5.6")) < 0 - || (currentVersion.getBaseVersion().compareTo(GradleVersion.version("6.0")) >= 0 - && currentVersion.compareTo(GradleVersion.version("6.3")) < 0)) { - throw new GradleException("Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). " + 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); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java index 708187af8e..5405ca4fc6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java @@ -21,7 +21,6 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Stream; -import org.gradle.api.JavaVersion; import org.gradle.util.GradleVersion; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.Extension; @@ -43,19 +42,8 @@ import org.springframework.util.StringUtils; */ final class GradleCompatibilityExtension implements TestTemplateInvocationContextProvider { - private static final List GRADLE_VERSIONS; - - static { - JavaVersion javaVersion = JavaVersion.current(); - if (javaVersion.isCompatibleWith(JavaVersion.VERSION_14) - || javaVersion.isCompatibleWith(JavaVersion.VERSION_13)) { - GRADLE_VERSIONS = Arrays.asList("6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1", "current", "7.0-milestone-3"); - } - else { - GRADLE_VERSIONS = Arrays.asList("5.6.4", "6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1", "current", - "7.0-milestone-3"); - } - } + private static final List GRADLE_VERSIONS = Arrays.asList("6.3", "6.4.1", "6.5.1", "6.6.1", "6.7.1", + "current", "7.0-milestone-3"); @Override public Stream provideTestTemplateInvocationContexts(ExtensionContext context) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java index 2184f2edad..024fa4a6d1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java @@ -1,5 +1,5 @@ /* - * 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"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.boot.gradle.plugin; -import java.io.File; -import java.io.IOException; - import org.gradle.testkit.runner.BuildResult; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledForJreRange; @@ -40,34 +37,12 @@ class SpringBootPluginIntegrationTests { final GradleBuild gradleBuild = new GradleBuild(); - @DisabledForJreRange(min = JRE.JAVA_14) - @Test - void failFastWithVersionOfGradle5LowerThanRequired() { - BuildResult result = this.gradleBuild.gradleVersion("5.5.1").buildAndFail(); - assertThat(result.getOutput()) - .contains("Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). " - + "The current version is Gradle 5.5.1"); - } - @DisabledForJreRange(min = JRE.JAVA_14) @Test void failFastWithVersionOfGradle6LowerThanRequired() { BuildResult result = this.gradleBuild.gradleVersion("6.2.2").buildAndFail(); assertThat(result.getOutput()) - .contains("Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). " - + "The current version is Gradle 6.2.2"); - } - - @DisabledForJreRange(min = JRE.JAVA_13) - @Test - void succeedWithVersionOfGradle5HigherThanRequired() { - this.gradleBuild.gradleVersion("5.6.1").build(); - } - - @DisabledForJreRange(min = JRE.JAVA_13) - @Test - void succeedWithVersionOfGradle5MatchingWhatIsRequired() { - this.gradleBuild.gradleVersion("5.6").build(); + .contains("Spring Boot plugin requires Gradle 6 (6.3 or later). The current version is Gradle 6.2.2"); } @Test @@ -75,10 +50,4 @@ class SpringBootPluginIntegrationTests { this.gradleBuild.gradleVersion("6.3").build(); } - private void createMinimalMainSource() throws IOException { - File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example"); - examplePackage.mkdirs(); - new File(examplePackage, "Application.java").createNewFile(); - } - }