Michal Kordas Michal Kordas - 6 months ago 54
Groovy Question

Get list of Gradle tasks in type-safe way

I need to configure all tasks of type

with some custom configuration.

Right now I'm doing it as follows:

[findbugsMain as FindBugs, findbugsTest as FindBugs].each {
... // 'it' has now inferred 'FindBugs' type

However, I'm limited to the tasks I explicitly know and I need to perform nasty casts.

Is it possible to get list of all tasks of some particular type in some type-safe or compile-static friendly manner?


You can do it by: