gradle
8.4

# apply

abstract fun apply(pluginId: String)(source)

Applies the plugin with the given ID. Does nothing if the plugin has already been applied.

Plugins in the `"org.gradle"` namespace can be applied directly via name. That is, the following two lines are equivalent…

    pluginManager.apply "org.gradle.java"
    pluginManager.apply "java"

Content copied to clipboard

#### Parameters

pluginId

the ID of the plugin to apply

abstract fun apply(type: Class<out Any>)(source)

Applies the given plugin. Does nothing if the plugin has already been applied.

The given class should implement the org.gradle.api.Plugin interface, and be parameterized for a compatible type of `this`.

The following two lines are equivalent…

    pluginManager.apply org.gradle.api.plugins.JavaPlugin
    pluginManager.apply "org.gradle.java"

Content copied to clipboard

#### Parameters

type

the plugin class to apply