Is there any way to override an extension property from gradle.properties?


(andrew.oberstar) #1

One example of a property I would like to do this with is the root directory for the WebSphere installation. I would like to expose it as an extension (i.e. was.homeDir) to namespace it a little more. However, I haven’t found a way to override that from gradle.properties. Adding a was.homeDir property there adds it as project.‘was.homeDir’.

The only thing I can think of to get that behavior is scraping the project properties looking for ones starting with “was.” and applying them to the extension object. But that seems kind of gross.

Anything I can do besides leaving them as convention properties?


(Peter Niederwieser) #2

There isn’t a generic way to do this at the moment (and it’s not easy to implement it well). You’ll have to code something yourself (like the solution you mentioned). I don’t think you can set convention properties either; the only thing you can set is a dynamic project property (i.e. a property that isn’t predefined).


(andrew.oberstar) #3

Thanks for the response. I’ll have to look into it some more and see whether it seems worth it to implement.

FYI, for some reason I don’t get notified by the forum when you respond to my posts. I do when others respond though…