3

In gradle.build.kts, is there any difference between following two

plugins {
    id("org.jetbrains.kotlin.jvm") version "1.5.31" // simple way
}

plugins {
    kotlin("jvm") version "1.5.31" // indirect way
}

Is there any reason not to use id("org.jetbrains.kotlin.jvm")?

Context:

  • I'm pretty sure that functionally these two are identical. (from decompiled code)

  • I strongly prefer id("org.jetbrains.kotlin.jvm"). (e.g. gradle errors contain org.jetbrains.kotlin.jvm, not kotlin("jvm"))

  • Some (most?) docs use kotlin("jvm") kotlinlang.org/..,
    but id("org.jetbrains.kotlin.jvm") is also used plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm docs.gradle.org/current/samples/sample_building_kotlin_libraries.html,
    so "undocumented way" should not apply.

  • I assume I am missing something, because I fail to understand the reason for existence of kotlin("jvm"). (actually I got two theories, both of which seem subpar: 17 characters seemed very important to somebody, "coolness" factor)

IndustryUser1942
  • 1,052
  • 1
  • 8
  • 12
  • If you navigate to source you’ll find that they’re literally the same thing. I personally find `kotlin(“jvm”)` more readable. – Boris the Spider Dec 20 '21 at 09:37

0 Answers0