For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

registerIfAbsent

abstract fun <T : BuildService<P>?, P : BuildServiceParameters?> registerIfAbsent(name: String, implementationType: Class<T>, configureAction: Action<in BuildServiceSpec<P>>): Provider<T>(source)

Registers a service, if a service with the given name is not already registered. The service is not created until required, when the returned Provider is queried.

Return

A Provider that will create the service instance when queried.

Since

6.1

Parameters

name

A name to use to identify the service.

implementationType

The service implementation type. Instances of the service are created as for newInstance.

configureAction

An action to configure the registration. You can use this to provide parameters to the service instance.


open fun <T : BuildService<P>?, P : BuildServiceParameters?> registerIfAbsent(name: String, implementationType: Class<T>): Provider<T>(source)

Registers a service, if a service with the given name is not already registered. The service is not created until required, when the returned Provider is queried.

Return

A Provider that will create the service instance when queried.

Since

8.7

Parameters

name

A name to use to identify the service.

implementationType

The service implementation type. Instances of the service are created as for newInstance.