Raise the minimum supported version of Gradle to 2.9

Closes gh-6884
This commit is contained in:
Andy Wilkinson 2016-11-01 16:23:43 +00:00
parent a733c62689
commit ef3395beaa
8 changed files with 46 additions and 26 deletions

View File

@ -76,7 +76,7 @@
<elasticsearch.version>2.4.0</elasticsearch.version>
<gemfire.version>8.2.0</gemfire.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>
<gson.version>2.7</gson.version>
<h2.version>1.4.193</h2.version>

View File

@ -39,8 +39,8 @@ diverge from the defaults.
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
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
2.8 and earlier is deprecated. Gradle 3 is not supported.
build support is provided for Maven (3.2+) and Gradle 2 (2.9 or later). Gradle 3 is not
supported.
TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if
at all possible.
@ -205,9 +205,9 @@ scope.
[[getting-started-gradle-installation]]
==== Gradle installation
Spring Boot is compatible with Gradle 1.12 or 2.x but support for 2.8 and earlier is
deprecated. Gradle 2.14.1 is recommended. Gradle 3 is not supported. If you don't already
have Gradle installed you can follow the instructions at http://www.gradle.org/.
Spring Boot is compatible with Gradle 2 (2.9 or later). Gradle 2.14.1 is recommended and
Gradle 3 is not supported. 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

View File

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

View File

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

View File

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

View File

@ -192,11 +192,6 @@
<artifactId>aether-util</artifactId>
<version>${aether.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
@ -207,6 +202,26 @@
<artifactId>gradle-base-services-groovy</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-language-java</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-language-jvm</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-platform-jvm</artifactId>
<version>${gradle.version}</version>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-plugins</artifactId>

View File

@ -33,6 +33,11 @@
<artifactId>groovy</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId>
@ -40,7 +45,17 @@
</dependency>
<dependency>
<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>
</dependency>
<dependency>

View File

@ -22,9 +22,6 @@ import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.plugins.JavaPlugin;
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.agent.AgentPluginFeatures;
@ -41,15 +38,8 @@ import org.springframework.boot.gradle.run.RunPluginFeatures;
*/
public class SpringBootPlugin implements Plugin<Project> {
private static final Logger logger = LoggerFactory.getLogger(SpringBootPlugin.class);
@Override
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);
project.getPlugins().apply(JavaPlugin.class);
@ -67,7 +57,6 @@ public class SpringBootPlugin implements Plugin<Project> {
compile.doFirst(new Action<Task>() {
@Override
@SuppressWarnings("deprecation")
public void execute(Task t) {
if (compile.getOptions().getEncoding() == null) {
compile.getOptions().setEncoding("UTF-8");