Gradle Wrapper Configuration
Ability to configure default gradle wrapper via kotlin DSL
task<Wrapper>("wrapper") { /**...*/ }
above code spawns warning:
Creating a custom task named 'wrapper' has been deprecated and 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.'.
wrapper { }
above doesn't compile with following errors:
Line 45: wrapper {
^ Expression 'wrapper' cannot be invoked as a function. The function 'invoke()' is not found
Line 45: wrapper {
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val PluginDependenciesSpec.wrapper: PluginDependencySpec defined in org.gradle.kotlin.dsl
wrapper task with different name (e.g. gradleWrapper) doesn't work well with IntelliJ IDEA. IDEA doesn't not use it to configure the wrapper
Gradle 4.8.1
Accessors aren't generated for tasks, so just doing wrapper {} will fail to compile. The accessors for tasks may be done in https://github.com/gradle/kotlin-dsl/issues/879
To configure an existing task with type do something like the following:
tasks {
"wrapper"(Wrapper::class) {
// configuration here
}
}
This should be documented here:
https://docs.gradle.org/current/userguide/gradle_wrapper.html
tasks.withType<Wrapper> {
gradleVersion = "4.9"
// anything else
}
Superseded by https://github.com/gradle/gradle/pull/5923
Most helpful comment