Fix gradle warnings

This commit fixes the following warnings:

```
$ ./gradlew clean --warning-mode all

> Configure project :

The Task.leftShift(Closure) method has been deprecated.
This is scheduled to be removed in Gradle 5.0.
Please use Task.doLast(Action) instead.
 at build_1u4zf89udullsb7m3yccjzfxt$_run_closure3.doCall(/spring-batch/build.gradle:187)
 (Run with --stacktrace to get the full stack trace of this deprecation warning.)

Creating a custom task named 'wrapper' has been deprecated.
This is scheduled to be removed in Gradle 5.0.
You can configure the existing task using the 'wrapper { }' syntax or
create your custom task under a different name.
 at build_1u4zf89udullsb7m3yccjzfxt.run(/spring-batch/build.gradle:921)
 (Run with --stacktrace to get the full stack trace of this deprecation warning.)

BUILD SUCCESSFUL in 3s
10 actionable tasks: 1 executed, 9 up-to-date
```

It also fixes the following warning about annotation processing:

```
Detecting annotation processors on the compile classpath has been deprecated.
Gradle 5.0 will ignore annotation processors on the compile classpath.
If you did not intend to use annotation processors,
you can use the '-proc:none' compiler argument to ignore them.
```

References:

* Spring Boot issue #6421
* https://discuss.gradle.org/t/regarding-the-annotation-processors-on-compile-classpath-warning-in-gradle-4-6
This commit is contained in:
Mahmoud Ben Hassine
2019-01-28 14:29:30 +01:00
parent 42596920e6
commit 197f32eb21

View File

@@ -147,7 +147,7 @@ configure(subprojects - project(":spring-build-src")) { subproject ->
// enable all compiler warnings; individual projects may customize further
ext.xLintArg = '-Xlint:all'
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg]
[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg] + '-proc:none'
tasks.withType(Test).all {
// suppress all console output during testing unless running `gradle -i`
@@ -184,21 +184,23 @@ configure(subprojects - project(":spring-build-src")) { subproject ->
from javadoc
}
task checkTestConfigs << {
def configFiles = []
sourceSets.test.java.srcDirs.each {
fileTree(it).include('**/*.xml').exclude('**/log4j.xml').each { configFile ->
def configXml = new XmlParser(false, false).parse(configFile)
task checkTestConfigs {
doLast {
def configFiles = []
sourceSets.test.java.srcDirs.each {
fileTree(it).include('**/*.xml').exclude('**/log4j.xml').each { configFile ->
def configXml = new XmlParser(false, false).parse(configFile)
if (configXml.@'xsi:schemaLocation' ==~ /.*spring-[a-z-]*\d\.\d\.xsd.*/) {
configFiles << configFile
if (configXml.@'xsi:schemaLocation' ==~ /.*spring-[a-z-]*\d\.\d\.xsd.*/) {
configFiles << configFile
}
}
}
}
if (configFiles) {
throw new InvalidUserDataException('Hardcoded XSD version in the config files:\n' +
configFiles.collect {relativePath(it)}.join('\n') +
'\nPlease, use versionless schemaLocations for Spring XSDs to avoid issues with builds on different versions of dependencies.')
if (configFiles) {
throw new InvalidUserDataException('Hardcoded XSD version in the config files:\n' +
configFiles.collect { relativePath(it) }.join('\n') +
'\nPlease, use versionless schemaLocations for Spring XSDs to avoid issues with builds on different versions of dependencies.')
}
}
}
@@ -918,7 +920,7 @@ or specify the Gradle property `TCK_HOME`, e.g: ./gradlew runTck -PTCK_HOME=/pat
}
}
task wrapper(type: Wrapper) {
wrapper {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '4.10'
}