service

abstract fun <T : GradleService?> service(serviceType: Class<T>): T(source)

Looks up a service provided by Gradle for use in init scripts and Gradle plugins.

The services available for lookup are the Gradle types that implement GradleService.

This method does not provide access to shared build services; use getSharedServices to access those.

Return

the service instance. Never returns null.

Since

9.8.0

Parameters

serviceType

the type of the service to look up

<T>

the service type

Throws

when the given type is not one of the services available in this scope