service
Looks up a service provided by Gradle for use in this task.
The services available for lookup are the Gradle types that implement TaskService.
The lookup can be used both at configuration time and from task actions at execution time, and is safe to use with the configuration cache:
tasks.register("cleanThing") {
doLast {
service(FileSystemOperations).delete {
delete("thing")
}
}
}
Content copied to clipboard
This method does not provide access to shared build services; use org.gradle.api.services.ServiceReference to access those.
Return
the service instance. Never returns null.
Since
9.8.0
Parameters
service Type
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