Michal Kordas Michal Kordas - 1 year ago 130
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?

Answer Source

You can do it by:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download