Besides that using ext / extra properties is practically always a work-around for doing something not properly, do you use extra from the right object? Practically all domain objects are ExtensionAware and thus have it. Maybe you set in project but get it on task. Try for example project.extra....
You’re on point. I missed that most objects are ExtensionAware, so is the docker { … } extension I wanted to configure - thus it was looking there (where it was not set), I have to be explicit at the lookup so it uses project, thanks - working now.
For the “work-around” - the use-case is, that my build environment provider does set some props in the init.d gradle file in the GRADLE_USER_HOME and I am just a consumer, so they can change infrastructure related stuff and my build will use that automatically, e.g. repository credentials, URLs etc. which is managed externally.
How would you propose to properly do that, so that projects are still able to customize their whole build stack to their needs but can access externally managed build env props?
If they want to do infrastructure things, they should just do them from the init script and not rely on the build using certain properties.
To actually provide properties, they should just put them to <GRADLE_USER_HOME>/gradle.properties or supply them using -P ... instead of setting extra properties through an init script.