The "group" property gets some special treatment in gradle.
A simple multiproject test, with the following files:
group-magic\settings.gradle:
include 'sub'
-------------------------------------------------------------------------------------
group-magic\build.gradle:
group='testing'
prop='myprop'
println "in build.gradle: group=$group, prop=$prop"
task top << {
println "in task top: group=$group, prop=$prop"
}
-------------------------------------------------------------------------------------
group-magic\sub\build.gradle:
println "in sub/build.gradle: group=$group, prop=$prop"
task sub << {
println "in task sub: group=$group, prop=$prop"
}
Running "gradle top sub" results in the following output:
in build.gradle: group=testing, prop=myprop
in sub/build.gradle: group=group-magic, prop=myprop
:top
in task top: group=null, prop=myprop
:sub:sub
in task sub: group=null, prop=myprop
As you can see, the group property takes on three different values, while
the other property "prop" stays the same.
It is rather confusing to me that the group property is changed behind the
scenes in this manner.
Anyone who can enlighten me as to what is happening here, and what the logic
behind this behaviour is?
We typically want the group to be the same everywhere (i.e. inside and
outside all tasks on all levels).
Much like the behaviour you see from the other property "prop" in the
example.
What's the simplest way to achieve this?
Regards,
Steinar