[regression?] extra properties set in rootProject's build.gradle via subprojects{} is not visible in sub project's build.gradle

It is a multiple project build, in my rootProject’s build.gradle, I have:

subprojects
{
        ext.ver = [
            'junit': '4.8.2'
        ]
}

In one of my sub project’s build.gradle, I have: dependencies {

testCompile group: ‘opensource’, name: ‘junit’, version: ext.ver.junit, configuration: ‘runtime’ }

gradle 1.10 works well, but when upgrade to gradle 1.12, I errors out with:

> cannot get property 'ver' on extra properties extension as it does not exist

Should this be a regression?

This was an unintended breaking change. The difference is that in 1.12 the dependencies {} block now has its own ext space.

The solution is to change ‘ext.ver.junit’ to ‘project.ext.ver.junit’ in your subproject build.gradle.

Thanks Luke - that is what I did, what is the use case of ext space for dependencies?

This makes the dependencies {} block extensible with custom DSLs…

dependencies.extensions.create(“custom”, MyCustomDsl)

dependencies {

custom {

// custom dsl here

}

}

This was a feature request.

If something is extensible, it also gets an ext space.