I tried using tasks.named("wrapper") { ... } to configure the wrapper task, but got an error. The way it's working is: task wrapper(type: Wrapper) { ... } What syntax is this? I'm using Groovy DSL BTW.
The approach looks correct. Which error did you get? If it is only an issue in the IDE, you can also define the type of the task as part of 'named': *tasks.named('wrapper', Wrapper) { ... }* *task wrapper(type: Wrapper) { ... }* is one of the "convenience" notations introduced in Gradle 1 for Groovy DSL. It's likely to be deprecated in the future. It is the same as doing *task.getByName('wrapper', Wrapper) { ... }* or (if the task does not exist) *task.create('wrapper', Wrapper) { ... }* . In your case, it might create the task if it does not yet exists for whatever reason, but that's probably not what you want. Which is one of the reasons I think this notation is a bit "too magical".
Thanks for the helpful video. I was struggling to migrate for several things mentioned in the video from Groovy to Kotlin
I tried using tasks.named("wrapper") { ... } to configure the wrapper task, but got an error. The way it's working is: task wrapper(type: Wrapper) { ... } What syntax is this? I'm using Groovy DSL BTW.
The approach looks correct. Which error did you get? If it is only an issue in the IDE, you can also define the type of the task as part of 'named':
*tasks.named('wrapper', Wrapper) { ... }*
*task wrapper(type: Wrapper) { ... }* is one of the "convenience" notations introduced in Gradle 1 for Groovy DSL. It's likely to be deprecated in the future. It is the same as doing *task.getByName('wrapper', Wrapper) { ... }* or (if the task does not exist) *task.create('wrapper', Wrapper) { ... }* . In your case, it might create the task if it does not yet exists for whatever reason, but that's probably not what you want. Which is one of the reasons I think this notation is a bit "too magical".
@@jjohannesUnderstood, thanks! The problems was that I was doing this under a subproject configuration instead of the parent.