Extra Properties Extension
Additional, ad-hoc, properties for Gradle domain objects.
Extra properties extensions allow new properties to be added to existing domain objects. They act like maps, allowing the storage of arbitrary key/value pairs. All ExtensionAware Gradle domain objects intrinsically have an extension named “{@value #EXTENSION_NAME}” of this type.
An important feature of extra properties extensions is that all of its properties are exposed for reading and writing via the ExtensionAware object that owns the extension.
project.ext.set("myProp", "myValue")
assert project.myProp == "myValue"
project.myProp = "anotherValue"
assert project.myProp == "anotherValue"
assert project.ext.get("myProp") == "anotherValue"
extension.«name»
and set via extension.«name» = "value"
. Wherever possible, the Groovy property syntax should be preferred over the get and set methods.project.ext {
myprop = "a"
}
assert project.myprop == "a"
assert project.ext.myprop == "a"
project.myprop = "b"
assert project.myprop == "b"
assert project.ext.myprop == "b"
project.ext["otherProp"] = "a"
assert project.otherProp == "a"
assert project.ext["otherProp"] == "a"
Types
Properties
Functions
Returns a property delegate provider that will initialize the extra property to the given initialValue.
Returns a property delegate provider that will initialize the extra property to the value provided by initialValueProvider.
Provides property delegate for typed access to extra properties.