Kotlin equivalents for various Java plugins (like java-library)

Are there kotlin equivalents to java-library, java-gradle-plugin, and similar libraries?

Or are there versions that aren’t java-specific? I imagine that java-library is probably necessarily java-specific, since it is based on top of the java dependency configurations like implementation, but, maybe there’s a way to overlay a plugin over any other plugin that supplies certain configurations…

e.g., I saw bundledGradlePlugin() (presumably from the kotlin-dsl-plugin-bundle plugin) used in the following:

There’s no need for Kotlin equivalents, you can simply apply the Kotlin plugin on top. The only java-specific thing about those plugins is that they will create a JavaCompile task for each SourceSet. But if you don’t write Java, that won’t make any difference.

The docs for java-library state that:

At the moment the Java Library plugin is only wired to behave correctly with the java plugin. Other plugins, such as the Groovy plugin, may not behave correctly.

Are the docs out-of-date, or do incompatibilities still remain? The docs show a workaround for Groovy. Must an equivalent workaround be used for Kotlin? Or are there either other incompatibilities, or no incompatibilities, with Kotlin?

The Kotlin plugin already includes that code, so it’ll work just fine. I’ll make a note to finally fix the Groovy and Scala plugins and remove that sentence from the docs.

1 Like