Raise the minimum version of Gradle to 4.0

Closes gh-9516
pull/9764/head
Andy Wilkinson 7 years ago
parent 32a40673bb
commit c2459fce47

@ -166,7 +166,7 @@ Advanced configuration options and examples are available in the
== Spring Boot Gradle plugin
The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, allowing you to
package executable jar or war archives, run Spring Boot applications and use the
dependency management provided by `spring-boot-dependencies`. It requires Gradle 3.4 or
dependency management provided by `spring-boot-dependencies`. It requires Gradle 4.0 or
later. Please refer to the plugin's documentation to learn more:
* Reference ({spring-boot-gradle-plugin}/reference/html[HTML] and

@ -38,7 +38,7 @@ diverge from the defaults.
== System Requirements
Spring Boot {spring-boot-version} requires http://www.java.com[Java 8] and Spring
Framework {spring-version} or above. Explicit build support is provided for Maven
(3.2+), and Gradle 3 (3.4 or later).
(3.2+), and Gradle 4.
[[getting-started-system-requirements-servlet-containers]]
@ -185,8 +185,8 @@ scope.
[[getting-started-gradle-installation]]
==== Gradle installation
Spring Boot is compatible with Gradle 3 (3.4 or later). If you don't already have Gradle
installed you can follow the instructions at http://www.gradle.org/.
Spring Boot is compatible with Gradle 4. If you don't already have Gradle installed you
can follow the instructions at http://www.gradle.org/.
Spring Boot dependencies can be declared using the `org.springframework.boot` `group`.
Typically your project will declare dependencies to one or more

@ -51,7 +51,7 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson;
:propdeps-plugin: https://github.com/spring-projects/gradle-plugins/tree/master/propdeps-plugin
:ant-manual: http://ant.apache.org/manual
:code-examples: ../java/org/springframework/boot
:gradle-user-guide: https://docs.gradle.org/3.4.1/userguide
:gradle-user-guide: https://docs.gradle.org/4.0.2/userguide
:hibernate-documentation: http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html
:jetty-documentation: https://www.eclipse.org/jetty/documentation/9.4.x
:tomcat-documentation: https://tomcat.apache.org/tomcat-8.5-doc

@ -1,7 +1,6 @@
plugins {
id 'java'
id 'eclipse'
id 'org.sonarqube' version '2.2.1'
}
repositories {

@ -1,6 +1,6 @@
#Thu Mar 16 20:08:41 GMT 2017
#Thu Jul 27 14:32:22 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip

@ -36,7 +36,7 @@ Andy Wilkinson
The Spring Boot Gradle Plugin provides Spring Boot support in https://gradle.org[Gradle],
allowing 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 3.4 or later.
Gradle plugin requires Gradle 4.0 or later.
In addition to this user guide, {api-documentation}[API documentation] is also available.

@ -68,8 +68,8 @@ public class SpringBootPlugin implements Plugin<Project> {
}
private void verifyGradleVersion() {
if (GradleVersion.current().compareTo(GradleVersion.version("3.4")) < 0) {
throw new GradleException("Spring Boot plugin requires Gradle 3.4 or later."
if (GradleVersion.current().compareTo(GradleVersion.version("4.0")) < 0) {
throw new GradleException("Spring Boot plugin requires Gradle 4.0 or later."
+ " The current version is " + GradleVersion.current());
}
}

@ -38,8 +38,8 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
*/
public final class GradleCompatibilitySuite extends Suite {
private static final List<String> GRADLE_VERSIONS = Arrays.asList("default", "3.4.1",
"3.5", "3.5.1", "4.0", "4.0.1", "4.1-rc-1");
private static final List<String> GRADLE_VERSIONS = Arrays.asList("default",
"4.1-rc-1");
public GradleCompatibilitySuite(Class<?> clazz) throws InitializationError {
super(clazz, createRunners(clazz));

@ -36,19 +36,19 @@ public class SpringBootPluginIntegrationTests {
@Test
public void failFastWithVersionOfGradleLowerThanRequired() {
BuildResult result = this.gradleBuild.gradleVersion("3.3").buildAndFail();
assertThat(result.getOutput()).contains("Spring Boot plugin requires Gradle 3.4"
+ " or later. The current version is Gradle 3.3");
BuildResult result = this.gradleBuild.gradleVersion("3.5.1").buildAndFail();
assertThat(result.getOutput()).contains("Spring Boot plugin requires Gradle 4.0"
+ " or later. The current version is Gradle 3.5.1");
}
@Test
public void succeedWithVersionOfGradleHigherThanRequired() {
this.gradleBuild.gradleVersion("3.5").build();
this.gradleBuild.gradleVersion("4.0.1").build();
}
@Test
public void succeedWithVersionOfGradleMatchingWhatIsRequired() {
this.gradleBuild.gradleVersion("3.4").build();
this.gradleBuild.gradleVersion("4.0").build();
}
}

@ -51,7 +51,7 @@ public class BootRunIntegrationTests {
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("1. " + urlOf(mainJavaOutput()));
assertThat(result.getOutput()).contains("1. " + urlOf("build/classes/java/main"));
assertThat(result.getOutput()).contains("2. " + urlOf("build/resources/main"));
assertThat(result.getOutput()).doesNotContain(urlOf("src/main/resources"));
}
@ -65,7 +65,7 @@ public class BootRunIntegrationTests {
BuildResult result = this.gradleBuild.build("bootRun");
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("1. " + urlOf("src/main/resources"));
assertThat(result.getOutput()).contains("2. " + urlOf(mainJavaOutput()));
assertThat(result.getOutput()).contains("2. " + urlOf("build/classes/java/main"));
assertThat(result.getOutput()).doesNotContain(urlOf("build/resources/main"));
}
@ -87,13 +87,6 @@ public class BootRunIntegrationTests {
.contains("JVM arguments = [-Dcom.foo=bar, -Dcom.bar=baz]");
}
private String mainJavaOutput() {
String gradleVersion = this.gradleBuild.getGradleVersion();
return "build/classes/"
+ (gradleVersion != null && gradleVersion.startsWith("4.") ? "java/" : "")
+ "main";
}
private String urlOf(String path) throws IOException {
return new File(this.gradleBuild.getProjectDir().getCanonicalFile(), path).toURI()
.toURL().toString();

Loading…
Cancel
Save