Project specific properties

hi

I have a multi project build. I have a property “abc” which is true by default.

root project → abc=false // do not the action

sub project A → abc=false // do not the action

sub project B → no property abc is set (which means true = do the action)

How can I achieve this with Gradle? sub-project-b/gradle.properties with no property set does not work with project.findProperty and project.getProperty (together with hasProperty)

You can’t “set” a project property value to true by not setting it when a parent project has the value set to false by default. Project properties are inherited from parent projects by subprojects.

Therefore, if you don’t set a value for abc in subproject B, abc=false would be inherited from the root project. You would explicitly need to set abc=true in B.

Otherwise, you could possibly prefix the properties so each is different. i.e. project.hasProperty("${project.name}.abc") or similar.