Use the Action overloads of flatDir and mavenCentral

Apache 2.0

Gradle 9.6 deprecates RepositoryHandler.flatDir(Map) and RepositoryHandler.mavenCentral(Map) in favor of the Action overloads that configure the repository through its own API. This recipe rewrites flatDir dirs: 'libs' to flatDir { dirs 'libs' } and mavenCentral name: 'central2' to mavenCentral { name = 'central2' }. Map notation carrying keys with no straightforward equivalent, such as the separately deprecated artifactUrls, is left alone.

org.openrewrite.gradle.gradle9.UseRepositoryHandlerActionOverloads
mod run . --recipe=org.openrewrite.gradle.gradle9.UseRepositoryHandlerActionOverloads

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