How many instances of plugin applied to different projects used in Gradle during execution of a task?
For example, when gradle build
for class BuildChecksPlugin : Plugin<Project> { ... }
.
I need to know the answer to this question: whether to use private class variable or not.
As you can inject various project-specific services like the project, project layout, and so on, it should be one instance per project I’d say, but just try it.
If you would elaborate on your use-case, maybe you could get a recommendation how to do it idiomatically.
Besides that on different projects the plugin class could even be different class instances if the plugin is not present on a common class loader like in the classpath of a common ancestor project’s build script.