# withPlugin

abstract fun withPlugin(id: String, action: Action<in AppliedPlugin>)(source)

Executes the given action when the specified plugin is applied.

If a plugin with the specified ID has already been applied, the supplied action will be executed immediately. Otherwise, the action will executed immediately after a plugin with the specified ID is applied.

The given action is always executed after the plugin has been applied.

#### Since

2.3

#### Parameters

id

the plugin ID. See findPlugin for details about this parameter.

action

the action to execute if/when the plugin is applied