Coming off my previous question “Configuring a multi project using an external build script”, I wish to extend that pattern using “apply from” to apply defined properties. I find this doesn’t work. It seems to work for tasks but not for properties.
I want to take the same external file (rpm_defaults.gradle),
println "configuring $project" task hiya << { task -> println 'hiya from rpm_defaults in project ' + project.name}
but modify it so that it also defines some properties:
def myProperty='get off my lawn' println "configuring $project" task hiya << { task -> println 'hiya from rpm_defaults in project ' + project.name}
I want to apply this external file through my parent as before.
Base directory build.gradle:
subprojects {
apply from: '../../rpm_defaults/rpm_defaults.gradle'
}
Base directory settings.gradle
include 'p1','p2','p3'
But I find that although the task defined in rpm_defaults.gradle is “injected” (is that the correct word?) into all the children of the parent project, the property I have defined does not, If I attempt to use it I get an error.
How may I define such a property in this external project and access it in child projects?