@Documented @Retention(RUNTIME) @Target({METHOD,FIELD}) @Incubating public @interface ServiceReference
Marks a task property as being a holder to a BuildService
.
When you annotate a shared build service property with this annotation, there is no need to explicitly declare the association between the task and the service; also, if you provide a service name to the annotation, and a shared build service is registered with that name, it will be automatically assigned to the property when the task is created.
It is an error to apply this annotation to a property whose type is not a subtype of BuildService
.
Modifier and Type | Optional Element | Description |
---|---|---|
java.lang.String |
value |
The optional name of the service which the annotated element references.
|
java.lang.String value
The optional name of the service which the annotated element references.
In case a service name is provided, if a shared build service is registered with that name, a provider to the service will be automatically assigned to the property.
If a shared build service with the specified name is not found, and no value or convention is explicitly set on the property:
Provider.get()
);Optional
,
Provider.get()