api / org.gradle.api.plugins / PluginContainer / apply

apply

abstract fun apply(id: String): Plugin<Any>

Has the same behavior as #apply(Class) except that the plugin is specified via its id. Not all plugins have an id.

Parameters

id - The id of the plugin to be applied.

Return
The plugin which has been used against the project.

abstract fun <T : Plugin<Any>> apply(type: Class<T>): T

Applies a plugin to the project. This usually means that the plugin uses the project API to add and modify the state of the project. This method can be called an arbitrary number of times for a particular plugin type. The plugin will be actually used only the first time this method is called.

Parameters

type - The type of the plugin to be used

Return
The plugin which has been used against the project.