Gradle properties in 2.6 vs 2.7

If I specify in ‘build.gradle’ that belongs to the root:
allprojects {

Then I want to use the same version property in a subproject like that:

dependencies {
    compile group: 'com.myproject.module', name: 'first', version: allprojects.version

In Gradle 2.6: it will put ‘[1.0-SNAPSHOT]’

In Gradle 2.7: it will be ‘1.0-SNAPSHOT’ without brackets

What can be the reason for that? Is that due to some gradle issues in
2.6? In gradle 2.2.1 - it also works fine (without brackets).

Short answer:
For a local project dependency, just use project(…)

dependencies {
    compile project(':first')

Long answer:
My guess is that allprojects.version is a List and the toString() method is adding the brackets. You could have used the following in a subproject

dependencies {
    compile group: 'com.myproject.module', name: 'first', version: project.version

Or less verbose as:

dependencies {
    compile "com.myproject.module:first:${project.version}"

But my first answer is best for a local project dependency

Thanks. Strange that it is treated differently in different versions of Gradle

It looks like something changed slightly but I wouldn’t lose any sleep over it as using allprojects.version is wrong.

I think what you are missing is that

allprojects {

Is the same as

allprojects({ Project p ->

Whereas allprojects.version is the same as getAllProjects().version

You can see from the [project interface] ( that getAllProjects() returns a Set<Project>