From 28a887ad0f7c526ca3ca113d776463fb3d189f51 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 21 Jun 2024 14:52:22 +0100 Subject: [PATCH] Raise minimum supported version of Gradle Closes gh-41180 --- .../build/MavenPublishingConventions.java | 3 - .../antora/modules/ROOT/pages/installing.adoc | 2 +- .../ROOT/pages/system-requirements.adoc | 2 +- .../build.gradle | 17 ----- .../spring-boot-gradle-plugin/build.gradle | 62 ------------------- .../gradle-plugin/pages/introduction.adoc | 2 +- .../gradle/testkit/GradleVersions.java | 4 +- .../spring-boot-loader-tools/build.gradle | 11 ---- .../spring-boot-image-tests/build.gradle | 16 ----- 9 files changed, 5 insertions(+), 114 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java index aae8016d431..05798d32996 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java @@ -102,9 +102,6 @@ class MavenPublishingConventions { private void customizeJavaMavenPublication(MavenPublication publication, Project project) { addMavenOptionalFeature(publication, project); - if (publication.getName().equals("pluginMaven")) { - return; - } publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy .fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME))); publication.versionMapping( diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/installing.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/installing.adoc index da678cd0557..65951bf4f1f 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/installing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/installing.adoc @@ -49,7 +49,7 @@ More details on getting started with Spring Boot and Maven can be found in the x [[getting-started.installing.java.gradle]] === Gradle Installation -Spring Boot is compatible with Gradle 7.x (7.5 or later) and 8.x. +Spring Boot is compatible with Gradle 7.x (7.6.4 or later) or 8.x (8.3 or later). 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-docs/src/docs/antora/modules/ROOT/pages/system-requirements.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/system-requirements.adoc index 935610d1dc9..50f42abb6d4 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/system-requirements.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/system-requirements.adoc @@ -13,7 +13,7 @@ Explicit build support is provided for the following build tools: | 3.6.3 or later | Gradle -| 7.x (7.5 or later) and 8.x +| Gradle 7.x (7.6.4 or later) or 8.x (8.3 or later) |=== diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle index 9d6d8c1268d..e6f5acba7c2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle @@ -6,23 +6,6 @@ plugins { description = "Spring Boot Buildpack Platform" -configurations.all { - resolutionStrategy { - eachDependency { dependency -> - // Downgrade Jackson as Gradle cannot cope with 2.15.0's multi-version - // jar files with bytecode in META-INF/versions/19 - if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { - dependency.useVersion("2.14.2") - } - // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's - // multi-version jar files with bytecode in META-INF/versions/21 - if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("$springFramework60xVersion") - } - } - } -} - dependencies { api("com.fasterxml.jackson.core:jackson-databind") api("com.fasterxml.jackson.module:jackson-module-parameter-names") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index ff5bb2bc585..dcd07e23715 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -15,53 +15,6 @@ configurations { // Downgrade SLF4J is required for tests to run in Eclipse resolutionStrategy.force("org.slf4j:slf4j-api:1.7.36") } - modernGradleRuntimeClasspath { - extendsFrom runtimeClasspath - canBeConsumed = false - canBeResolved = true - } - modernGradleRuntimeElements { - extendsFrom configurations.implementation, configurations.runtimeOnly - canBeConsumed = true - canBeResolved = false - attributes { - attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category, Category.LIBRARY)) - attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling, Bundling.EXTERNAL)) - attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17) - attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR)) - attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage, Usage.JAVA_RUNTIME)) - attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, project.objects.named(GradlePluginApiVersion, "8.7")) - } - outgoing.artifacts.addAll(configurations.runtimeElements.outgoing.artifacts) - } - runtimeElements { - attributes { - attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, project.objects.named(GradlePluginApiVersion, "7.5")) - } - } - all { configuration -> - if (configuration.name == 'modernGradleRuntimeClasspath') { - return - } - resolutionStrategy { - eachDependency { dependency -> - // Downgrade Jackson as Gradle cannot cope with 2.15.0's multi-version - // jar files with bytecode in META-INF/versions/19 - if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { - dependency.useVersion("2.14.2") - } - // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's - // multi-version jar files with bytecode in META-INF/versions/21 - if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("$springFramework60xVersion") - } - } - } - } -} - -components.java.addVariantsFromConfiguration(configurations.modernGradleRuntimeElements) { - mapToMavenScope("runtime") } dependencies { @@ -178,18 +131,3 @@ artifacts { toolchain { maximumCompatibleJavaVersion = JavaLanguageVersion.of(20) } - -publishing { - publications.matching { it.name == 'pluginMaven' }.configureEach { - versionMapping { - allVariants { - fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) - } - } - versionMapping { - variant(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, project.objects.named(GradlePluginApiVersion, "8.7")) { - fromResolutionOf("modernGradleRuntimeClasspath") - } - } - } -} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/introduction.adoc b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/introduction.adoc index 5f2c1deddce..62735dcc6e1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/introduction.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/introduction.adoc @@ -3,6 +3,6 @@ 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 7.x (7.5 or later) or 8.x and can be used with Gradle's {url-gradle-docs}/configuration_cache.html[configuration cache]. +Spring Boot's Gradle plugin requires Gradle 7.x (7.6.4 or later) or 8.x (8.3 or later) and can be used with Gradle's {url-gradle-docs}/configuration_cache.html[configuration cache]. In addition to this user guide, xref:api/java/index.html[API documentation] is also available. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java index 85d15de32d4..35cfef6ba02 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java @@ -35,9 +35,9 @@ public final class GradleVersions { @SuppressWarnings("UnstableApiUsage") public static List allCompatible() { if (isJavaVersion(JavaVersion.VERSION_20)) { - return Arrays.asList("8.1.1", "8.8"); + return Arrays.asList("8.3", "8.8"); } - return Arrays.asList("7.5.1", GradleVersion.current().getVersion(), "8.0.2", "8.8"); + return Arrays.asList(GradleVersion.current().getVersion(), "8.3", "8.8"); } public static String minimumCompatible() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle index 4033e3e8a0f..609bdbac2af 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle @@ -21,17 +21,6 @@ configurations { extendsFrom dependencyManagement transitive = false } - all { - resolutionStrategy { - eachDependency { dependency -> - // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's - // multi-version jar files with bytecode in META-INF/versions/21 - if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("$springFramework60xVersion") - } - } - } - } } dependencies { diff --git a/spring-boot-system-tests/spring-boot-image-tests/build.gradle b/spring-boot-system-tests/spring-boot-image-tests/build.gradle index 40cd4ee6016..455e14076b4 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/build.gradle +++ b/spring-boot-system-tests/spring-boot-image-tests/build.gradle @@ -11,22 +11,6 @@ configurations { providedRuntime { extendsFrom dependencyManagement } - all { - resolutionStrategy { - eachDependency { dependency -> - // Downgrade Jackson as Gradle cannot cope with 2.15.0's multi-version - // jar files with bytecode in META-INF/versions/19 - if (dependency.requested.group.startsWith("com.fasterxml.jackson")) { - dependency.useVersion("2.14.2") - } - // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's - // multi-version jar files with bytecode in META-INF/versions/21 - if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("$springFramework60xVersion") - } - } - } - } } task syncMavenRepository(type: Sync) {