0

The normal way is this:

kotlin("jvm") version "1.7.22"

when I use libs.versions.toml:

[plugins]
kotlin-jvm = { module = "jvm", version.ref = "kotlin" }

How should plugins be declared in build.gradle.kts?

I already know a way to achieve the requirement, but I still want to know how to do it using kotlin functions:

// libs.versions.toml
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

// build.gradle.kts
alias(libs.plugins.kotlin.jvm)

How I get the id of the plugin through libs...?

SageJustus
  • 631
  • 3
  • 9
  • Does this answer your question? [Adding Kotlin plugins using plugins DSL](https://stackoverflow.com/questions/71152946/adding-kotlin-plugins-using-plugins-dsl) – aSemy Mar 24 '23 at 07:41
  • @aSemy No, this question is asking about the principle of `kotlin()`, what I am looking for is the usage of `kotlin()`. – SageJustus Mar 24 '23 at 08:27
  • 1
    I apologise, I misunderstood what you were asking for. You should be able to get the plugin ID with `libs.plugins.nexusPublish.get().pluginId`. However, I don't know if it will work with the `kotlin()` plugin ID shortcut. – aSemy Mar 24 '23 at 09:49
  • @aSemy you're right. I use `kotlin(libs.plugins.kotlin.jpa.get().pluginId)` compile successfully, haven't run yet but I believe it should work. – SageJustus Mar 24 '23 at 09:55

0 Answers0