How do I create a shadowed property in a subproject?

(Chris Jones) #1

For example, I have a version property that I want to be equal to “1.0” in all my subprojects except one, where it should instead be “1.0b1”. In my root project, I have this:

project.ext.version = "1.0"

and in the subproject, this:

project.ext.version = "1.0b1"

But the second assignment seems to have no effect; no matter which project tries to evaluate the version property, it always gets 1.0.

(Peter Niederwieser) #2

You do it like you described. The problem in your case is that there is already a static property ‘project.version’ provided by Gradle, which will always win over extra properties.

(Chris Jones) #3

Thanks for the help!