api / org.gradle.plugin.use / PluginDependencySpec / apply

apply

abstract fun apply(apply: Boolean): PluginDependencySpec

Specifies whether the plugin should be applied to the current project. Otherwise it is only put on the project's classpath.

This is useful when reusing classes from a plugin or to apply a plugin to sub-projects:

 plugins { id "org.company.myplugin" version "1.0" apply false } subprojects { if (someCondition) { apply plugin: "org.company.myplugin" } } 

Parameters

apply - whether to apply the plugin to the current project or not. Defaults to true

Return
this