Throughout Gradle there’s a convention that setting a property overwrites existing values whereas using the corresponding method appends values, at least when it comes to collection properties. Is it possible to do something similar in managed models?
I came across this apparent limitation when I implemented my own managed SourceSet
class that had a collection of include patterns. I tried implementing the model element as an abstract class with abstract getters and setters for includes
and an include()
method. But Gradle didn’t like that method as it wasn’t a getter or setter.