Emit warning when resolving against a specific repository

On my project, we have a central Maven server. Most of the time our builds use SNAPSHOT binaries retrieved from that server, and all is well. However, sometimes the binaries on the server are broken, and developers would like to override them with local copies built from source so they can keep working until their dependencies are fixed.

I figured I’d add mavenLocal to the top of the repository list, so that binaries published there would take precedence over the binaries downloaded from the server (and then use publishToMavenLocal to produce a local binary). This raises the issue that it’s easy to forget to switch back to using binaries from the server, which could lead to confusing compile problems as the local override takes precedence over newer versions on the server and such - especially since clearing the gradle cache wouldn’t fix anything.

I was asked to print a warning message when a dependency is found in mavenLocal, but I can’t find a way to hook into the dependency resolution process like that. Is there any way to do this? If not, is there any better way to do local overrides of dependencies that would be easily usable for non-Gradle-expert developers?

Maybe you can just display the retrieved dependencies in the build console, so the user will see that he’s using his local dependency (I guess his local dependency is not named as the snapshots are)

see https://docs.gradle.org/current/userguide/userguide_single.html#sec:listing_dependencies