Use matching(Closure) instead of findAll(Closure) on Gradle container collections

MSAL

Gradle 9.4 deprecates the Groovy DomainObjectCollection.findAll(Closure) overload on containers such as tasks, configurations, and sourceSets. It is replaced by the lazy DomainObjectCollection.matching(Closure), which returns a live collection that only filters elements as they are needed by the build. This recipe only swaps the method name, leaving the closure argument unchanged, rewriting findAll { ... } to matching { ... } when the receiver is a known Gradle container collection.

org.openrewrite.gradle.migrate.tasks.UseMatchingInsteadOfFindAll
mod run . --recipe=org.openrewrite.gradle.migrate.tasks.UseMatchingInsteadOfFindAll

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.