Declare dependency repositories in the settings file
MSALMove a build script's top-level repositories block into dependencyResolutionManagement in the settings file, so the build has one place that says where dependencies come from and a project cannot quietly resolve from somewhere the rest of the build does not. Deliberately narrow, because the risk is all in the cases it declines: a build with more than one project is left alone, since hoisting one project's repositories applies them to every project and can change which repository a coordinate resolves from; buildscript repositories resolve the build's own classpath, which dependencyResolutionManagement does not serve; publishing repositories are where artifacts go rather than where dependencies come from; and a block inside allprojects or subprojects is multi-project configuration whatever the build looks like today. A settings file that already declares dependencyResolutionManagement is left for a person to merge. See the Gradle best practice.
org. openrewrite. gradle. migrate. settings. MoveRepositoriesToSettingsmod run . --recipe= org. openrewrite. gradle. migrate. settings. MoveRepositoriesToSettingsInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.