api / org.gradle.api / Project / property

property

@Incubating abstract fun <T : Any> property(clazz: Class<T>): PropertyState<T>

Creates a PropertyState implementation based on the provided class.

Parameters

clazz - The class to be used for property state.

Exceptions

org.gradle.api.InvalidUserDataException - If the provided class is null.

Return
The property state. Never returns null.

See Also
org.gradle.api.provider.ProviderFactory#property(Class)

Since
4.0

@Nullable abstract fun property(propertyName: String): Any

Returns the value of the given property. This method locates a property as follows:

  1. If this project object has a property with the given name, return the value of the property.
  2. If this project has an extension with the given name, return the extension.
  3. If this project's convention object has a property with the given name, return the value of the property.
  4. If this project has an extra property with the given name, return the value of the property.
  5. If this project has a task with the given name, return the task.
  6. Search up through this project's ancestor projects for a convention property or extra property with the given name.
  7. If not found, a MissingPropertyException is thrown.

Parameters

propertyName - The name of the property.

Exceptions

MissingPropertyException - When the given property is unknown.

Return
The value of the property, possibly null.

See Also
Project#findProperty(String)