Skip to content

Commit

Permalink
Raise the minimum version of Gradle to 4.0
Browse files Browse the repository at this point in the history
Closes gh-9516
  • Loading branch information
wilkinsona committed Jul 28, 2017
1 parent 32a4067 commit c2459fc
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spring-boot-docs/src/main/asciidoc/getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-docs/src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion spring-boot-tools/spring-boot-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'java'
id 'eclipse'
id 'org.sonarqube' version '2.2.1'
}

repositories {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void apply(Project 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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
*/
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void basicExecution() throws IOException {
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"));
}
Expand All @@ -65,7 +65,7 @@ public void sourceResourcesCanBeUsed() throws IOException {
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"));
}

Expand All @@ -87,13 +87,6 @@ public void applicationPluginJvmArgumentsAreUsed() throws IOException {
.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();
Expand Down

0 comments on commit c2459fc

Please sign in to comment.