api / org.gradle.api.tasks.options / Option

Option

@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FIELD]) @Inherited @Incubating class Option

Marks a property of a org.gradle.api.Task as being configurable from the command-line.

This annotation should be attached to a field or a setter method. When attached to a field, #option() will use the name of the field by default. When attached to a method, #option() must be specified.

An option may have one of the following types:

Since
4.6

Constructors

<init>

Option(option: String, description: String)

Marks a property of a org.gradle.api.Task as being configurable from the command-line.

This annotation should be attached to a field or a setter method. When attached to a field, #option() will use the name of the field by default. When attached to a method, #option() must be specified.

An option may have one of the following types:

  • boolean
  • Boolean
  • Enum
  • List&lt;Enum&gt;
  • List&lt;String&gt;
  • String

Properties

description

val description: String

The description of this option.

option

val option: String

The option to map to this property. Required when annotating a method. May be omitted when annotating a field in which case the field's name will be used.