Plugin implementation does not implement the Plugin interface

I’ve got a stripped down version of a composite build where I was actually trying to create a SSCCE for a different problem, where Gradle tells me my plugin does not implement the Plugin interface when I’m pretty sure it does.

Plugin implementation ‘’ does not implement the Plugin interface. This plugin cannot be applied directly via the PluginContainer.

Anybody know what the real issue is here? (123.6 KB)

Some general advice first if you don’t mind:

  • do not use plugins., as you can see in its JavaDoc it shouldn’t be used, but either pluginManager. or in case of apply(...) the PluginAware interface directly.
  • do not use apply(...) to apply plugins, this is legacy way and discouraged, better always use the plugins DSL which is the recommended way and will also generate accessors for convenient configuration in Kotlin DSL build scripts and precompiled script plugins. The way you do it for examle implementation( in server/build.gradle.kts fails as no accessor get generated.
  • do not use subprojects { ... } or allprojects { ... } to inject configuration, better write convention plugins that you then apply to the projects where they are needed directly, this makes the build logic much cleaner and clearer and much more maintainable, and also then provides the generated accessors if applied via plugins DSL

And regarding your actual question, you created ExamplePlugin.kts instead of ExamplePlugin.kt.
As it is a .kts file, it is compiled as Kotlin script and so all the content is put into a synthetic class ExamplePlugin which implements ScriptTemplateWithArgs but not Plugin. Your plugin class is the inner class Change ExamplePlugin.kts to ExamplePlugin.kt and it should work.