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"
Content copied to clipboard
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"
Content copied to clipboard
project.ext["otherProp"] = "a"
assert project.otherProp == "a"
assert project.ext["otherProp"] == "a"
Content copied to clipboard
Types
Properties
Link copied to clipboard
The name of this extension in all ExtensionContainers, {@value}.