gradle
8.4

# ServiceReference

@Documented
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = [ElementType.METHOD, ElementType.FIELD])
@Incubating
annotation class ServiceReference(source)

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.

## Functions

annotationType
Link copied to clipboard
abstract fun annotationType(): Class<out Annotation>
equals
Link copied to clipboard
abstract fun equals(p: Any): Boolean
hashCode
Link copied to clipboard
abstract fun hashCode(): Int
toString
Link copied to clipboard
abstract fun toString(): String
value
Link copied to clipboard
abstract fun value(): String
The optional name of the service which the annotated element references.