service

inline fun <T : GradleService> Gradle.service(serviceType: KClass<T>): T(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.invocation.Gradle.service.

Since

9.8.0

See also


inline fun <T : TaskService> Task.service(serviceType: KClass<T>): T(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.Task.service.

Since

9.8.0

See also


inline fun <T : ProjectService> Project.service(serviceType: KClass<T>): T(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.Project.service.

Since

9.8.0

See also


inline fun <T : SettingsService> Settings.service(serviceType: KClass<T>): T(source)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.initialization.Settings.service.

Since

9.8.0

See also


Looks up a service provided by Gradle for use in this project.

Return

the service instance

Since

9.8.0

Type Parameters

T

the type of the service to look up

See also

Project.service

Throws

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


Looks up a service provided by Gradle for use in this task.

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")
}
}
}

Return

the service instance

Since

9.8.0

Type Parameters

T

the type of the service to look up

See also

Task.service

Throws

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


Looks up a service provided by Gradle for use in this build.

Return

the service instance

Since

9.8.0

Type Parameters

T

the type of the service to look up

See also

Settings.service

Throws

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


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

Return

the service instance

Since

9.8.0

Type Parameters

T

the type of the service to look up

See also

Gradle.service

Throws

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