Repositories with nested dependencies


I noticed in one of my buildscript that by Accident, I had nested the dependencies declaration inside the repositories declaration:

buildscript {
    repositories {
        flatDir {
            dirs "$rootDir/../build/libs"
        // EDIT: Original post had orthodox nesting
       dependencies {
            classpath 'example:custom-plugin:1.0.2-SNAPSHOT'

This seemed to work without error. Now I wonder, is this an intended feature (I did not see it documented), or just bad coding style that due to a glitch gets unnoticed. Or, in other words, is that a syntax to specify that this dependency is only to be looked for in that given repository?

Hey Thibault,
this works “by accident”, as the dependencies method will be used as if it would be declared on the root level of your build script. This is a known limitation and can confuse users. We’ll working on solving this in future gradle versions. At one point you’ll receive a reasonable error message.