# apply

abstract fun apply(pluginId: String)

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

#### Since

2.3

#### Parameters

pluginId

the ID of the plugin to apply

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

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

#### Since

2.3

#### Parameters

type

the plugin class to apply