mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Raise the minimum supported version of Gradle to 8.14 and support 9.x
Closes gh-43573 Closes gh-43574
This commit is contained in:
+1
-1
@@ -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.6.4 or later) or 8.x (8.4 or later) and can be used with Gradle's {url-gradle-docs}/configuration_cache.html[configuration cache].
|
||||
Spring Boot's Gradle plugin requires Gradle 8.x (8.14 or later) or 9.x 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.
|
||||
|
||||
+1
-1
@@ -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.6.4 or later) or 8.x (8.4 or later) and can be used with Gradle's {url-gradle-docs}/configuration_cache.html[configuration cache].
|
||||
Spring Boot's Gradle plugin requires Gradle 8.x (8.14 or later) or 9.x 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.
|
||||
|
||||
+11
@@ -20,9 +20,11 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.util.GradleVersion;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.gradle.dsl.SpringBootExtension;
|
||||
@@ -115,11 +117,20 @@ public class SpringBootPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
verifyGradleVersion();
|
||||
createExtension(project);
|
||||
Configuration bootArchives = createBootArchivesConfiguration(project);
|
||||
registerPluginActions(project, bootArchives);
|
||||
}
|
||||
|
||||
private void verifyGradleVersion() {
|
||||
GradleVersion currentVersion = GradleVersion.current();
|
||||
if (currentVersion.compareTo(GradleVersion.version("8.14")) < 0) {
|
||||
throw new GradleException("Spring Boot plugin requires Gradle 8.x (8.14 or later) or 9.x. "
|
||||
+ "The current version is " + currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
private void createExtension(Project project) {
|
||||
project.getExtensions().create("springBoot", SpringBootExtension.class, project);
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2012-present 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.gradle.plugin;
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledForJreRange;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.gradle.testkit.PluginClasspathGradleBuild;
|
||||
import org.springframework.boot.testsupport.BuildOutput;
|
||||
import org.springframework.boot.testsupport.gradle.testkit.GradleBuild;
|
||||
import org.springframework.boot.testsupport.gradle.testkit.GradleBuildExtension;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link SpringBootPlugin}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(GradleBuildExtension.class)
|
||||
class SpringBootPluginIntegrationTests {
|
||||
|
||||
final GradleBuild gradleBuild = new PluginClasspathGradleBuild(new BuildOutput(getClass()));
|
||||
|
||||
@Test
|
||||
@DisabledForJreRange(min = JRE.JAVA_24)
|
||||
void failFastWithVersionOfGradle8LowerThanRequired() {
|
||||
BuildResult result = this.gradleBuild.gradleVersion("8.13").buildAndFail();
|
||||
assertThat(result.getOutput()).contains(
|
||||
"Spring Boot plugin requires Gradle 8.x (8.14 or later) or 9.x. The current version is Gradle 8.13");
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -15,5 +15,5 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '{version}'
|
||||
id 'org.springframework.boot'
|
||||
}
|
||||
|
||||
@@ -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.6.4 or later) or 8.x (8.4 or later).
|
||||
Spring Boot is compatible with Gradle 8.x (8.14 or later) or 9.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`.
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ Explicit build support is provided for the following build tools:
|
||||
| 3.6.3 or later
|
||||
|
||||
| Gradle
|
||||
| Gradle 7.x (7.6.4 or later) or 8.x (8.4 or later)
|
||||
| Gradle 8.x (8.14 or later) and 9.x
|
||||
|===
|
||||
|
||||
|
||||
|
||||
+1
-13
@@ -33,19 +33,7 @@ public final class GradleVersions {
|
||||
}
|
||||
|
||||
public static List<String> allCompatible() {
|
||||
if (isJavaVersion(JavaVersion.VERSION_24)) {
|
||||
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
}
|
||||
if (isJavaVersion(JavaVersion.VERSION_23)) {
|
||||
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
}
|
||||
if (isJavaVersion(JavaVersion.VERSION_22)) {
|
||||
return Arrays.asList("8.8", GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
}
|
||||
if (isJavaVersion(JavaVersion.VERSION_21)) {
|
||||
return Arrays.asList("8.5", GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
}
|
||||
return Arrays.asList("7.6.6", "8.4", GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0", "9.1.0-rc-1");
|
||||
}
|
||||
|
||||
public static String minimumCompatible() {
|
||||
|
||||
Reference in New Issue
Block a user