Raise the minimum supported version of Gradle to 2.9

Closes gh-6884
pull/6613/head
Andy Wilkinson 8 years ago
parent a733c62689
commit ef3395beaa

@ -76,7 +76,7 @@
<elasticsearch.version>2.4.0</elasticsearch.version> <elasticsearch.version>2.4.0</elasticsearch.version>
<gemfire.version>8.2.0</gemfire.version> <gemfire.version>8.2.0</gemfire.version>
<glassfish-el.version>3.0.0</glassfish-el.version> <glassfish-el.version>3.0.0</glassfish-el.version>
<gradle.version>1.12</gradle.version> <gradle.version>2.9</gradle.version>
<groovy.version>2.4.7</groovy.version> <groovy.version>2.4.7</groovy.version>
<gson.version>2.7</gson.version> <gson.version>2.7</gson.version>
<h2.version>1.4.193</h2.version> <h2.version>1.4.193</h2.version>

@ -39,8 +39,8 @@ diverge from the defaults.
By default, Spring Boot {spring-boot-version} requires http://www.java.com[Java 7] and By default, Spring Boot {spring-boot-version} requires http://www.java.com[Java 7] and
Spring Framework {spring-version} or above. You can use Spring Boot with Java 6 with some Spring Framework {spring-version} or above. You can use Spring Boot with Java 6 with some
additional configuration. See <<howto.adoc#howto-use-java-6>> for more details. Explicit additional configuration. See <<howto.adoc#howto-use-java-6>> for more details. Explicit
build support is provided for Maven (3.2+) and Gradle (1.12 or 2.x). Support for Gradle build support is provided for Maven (3.2+) and Gradle 2 (2.9 or later). Gradle 3 is not
2.8 and earlier is deprecated. Gradle 3 is not supported. supported.
TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if
at all possible. at all possible.
@ -205,9 +205,9 @@ scope.
[[getting-started-gradle-installation]] [[getting-started-gradle-installation]]
==== Gradle installation ==== Gradle installation
Spring Boot is compatible with Gradle 1.12 or 2.x but support for 2.8 and earlier is Spring Boot is compatible with Gradle 2 (2.9 or later). Gradle 2.14.1 is recommended and
deprecated. Gradle 2.14.1 is recommended. Gradle 3 is not supported. If you don't already Gradle 3 is not supported. If you don't already have Gradle installed you can follow the
have Gradle installed you can follow the instructions at http://www.gradle.org/. instructions at http://www.gradle.org/.
Spring Boot dependencies can be declared using the `org.springframework.boot` `group`. Spring Boot dependencies can be declared using the `org.springframework.boot` `group`.
Typically your project will declare dependencies to one or more Typically your project will declare dependencies to one or more

@ -50,7 +50,7 @@ public class BootRunResourceTests {
public void resourcesDirectlyFromSource() { public void resourcesDirectlyFromSource() {
project.newBuild().forTasks("clean", "bootRun") project.newBuild().forTasks("clean", "bootRun")
.withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=true") .withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=true")
.run(); .setStandardOutput(System.out).run();
assertThat(this.output.toString()).contains("src/main/resources/test.txt"); assertThat(this.output.toString()).contains("src/main/resources/test.txt");
} }
@ -59,7 +59,7 @@ public class BootRunResourceTests {
public void resourcesFromBuildOutput() { public void resourcesFromBuildOutput() {
project.newBuild().forTasks("clean", "bootRun") project.newBuild().forTasks("clean", "bootRun")
.withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=false") .withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=false")
.run(); .setStandardOutput(System.out).run();
assertThat(this.output.toString()).contains("build/resources/main/test.txt"); assertThat(this.output.toString()).contains("build/resources/main/test.txt");
} }

@ -34,7 +34,7 @@ public class ProjectCreator {
private String gradleVersion; private String gradleVersion;
public ProjectCreator() { public ProjectCreator() {
this("1.12"); this("2.9");
} }
public ProjectCreator(String gradleVersion) { public ProjectCreator(String gradleVersion) {

@ -9,6 +9,7 @@ buildscript {
} }
} }
apply plugin: 'application'
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'org.springframework.boot' apply plugin: 'org.springframework.boot'

@ -192,6 +192,16 @@
<artifactId>aether-util</artifactId> <artifactId>aether-util</artifactId>
<version>${aether.version}</version> <version>${aether.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services-groovy</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.gradle</groupId> <groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId> <artifactId>gradle-core</artifactId>
@ -199,12 +209,17 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gradle</groupId> <groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId> <artifactId>gradle-language-java</artifactId>
<version>${gradle.version}</version> <version>${gradle.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gradle</groupId> <groupId>org.gradle</groupId>
<artifactId>gradle-base-services-groovy</artifactId> <artifactId>gradle-language-jvm</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-platform-jvm</artifactId>
<version>${gradle.version}</version> <version>${gradle.version}</version>
</dependency> </dependency>
<dependency> <dependency>

@ -33,6 +33,11 @@
<artifactId>groovy</artifactId> <artifactId>groovy</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gradle</groupId> <groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId> <artifactId>gradle-core</artifactId>
@ -40,7 +45,17 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gradle</groupId> <groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId> <artifactId>gradle-language-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-language-jvm</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-platform-jvm</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

@ -22,9 +22,6 @@ import org.gradle.api.Project;
import org.gradle.api.Task; import org.gradle.api.Task;
import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.util.GradleVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.gradle.SpringBootPluginExtension; import org.springframework.boot.gradle.SpringBootPluginExtension;
import org.springframework.boot.gradle.agent.AgentPluginFeatures; import org.springframework.boot.gradle.agent.AgentPluginFeatures;
@ -41,15 +38,8 @@ import org.springframework.boot.gradle.run.RunPluginFeatures;
*/ */
public class SpringBootPlugin implements Plugin<Project> { public class SpringBootPlugin implements Plugin<Project> {
private static final Logger logger = LoggerFactory.getLogger(SpringBootPlugin.class);
@Override @Override
public void apply(Project project) { public void apply(Project project) {
if (GradleVersion.current().compareTo(GradleVersion.version("2.9")) < 0) {
logger.warn("Spring Boot plugin's support for Gradle "
+ GradleVersion.current().getVersion()
+ " is deprecated. Please upgrade to Gradle 2.9 or later.");
}
project.getExtensions().create("springBoot", SpringBootPluginExtension.class, project.getExtensions().create("springBoot", SpringBootPluginExtension.class,
project); project);
project.getPlugins().apply(JavaPlugin.class); project.getPlugins().apply(JavaPlugin.class);
@ -67,7 +57,6 @@ public class SpringBootPlugin implements Plugin<Project> {
compile.doFirst(new Action<Task>() { compile.doFirst(new Action<Task>() {
@Override @Override
@SuppressWarnings("deprecation")
public void execute(Task t) { public void execute(Task t) {
if (compile.getOptions().getEncoding() == null) { if (compile.getOptions().getEncoding() == null) {
compile.getOptions().setEncoding("UTF-8"); compile.getOptions().setEncoding("UTF-8");

Loading…
Cancel
Save