I previously duplicated the repositories blocks which bothered me quite a bit, but not enough to take a closer look at the API than the documentation links above. I would have really appreciated a blurb like the one above.
I would not encourage people to do that too much. Every repository you add adds to dependency resolution time. The snippet you posted would add the Gradle Plugin Portal as a repository for project dependencies, which is almost definitely not needed.
Granted, the snippet above is a bit more absurd than it should be… That’s because I removed our local nexus repository/cache from the top of the list while copy-pasting it.
It is my understanding that searching stops once a dependency has been found in one of the configured repositories. I think I even saw a bug report complaining about this in case of SNAPSHOT versions but it feels like a feature to me.
So the above example should rather look like this:
Yes, Gradle will search the repositories in order. But you still want it to find the dependency as fast as possible or fail as fast as possible if it can’t be found. So for the buildscript block you want the Gradle Plugin Portal to be at the top, not the bottom. For the main project dependencies you don’t want it at all. These two usages have quite different requirements.
I think if you know what you are doing (and you do ), then having this in the JavaDoc is good enough.