Gradle: making Kotlin plugin use version of Kotlin specified by Gradle


#1

How can I tell the Kotlin plugin to only use the version of Kotlin specified by Gradle?

For instance, when I imported an existing Gradle project into EAP 16, I had to “configure Kotlin in project” – which dumped a bunch of Beta 4 runtimes into my /lib directory. However, Gradle was configured to use an older version of Kotlin’s stdlib, etc. There weren’t serious issues (the codebase was small, so it was easy to check) but I can see in the future how this might be a problem, so I’d like to learn how to strictly control the version of Kotlin used via Gradle sooner rather than later.

Forgive me for sounding a little rusty: Kotlin brought me back to the JVM and its ecosystem after several years, so my knowledge is a bit shallow right now.


#2

I treat Kotlin dependencies like all other dependencies in my Gradle build, and simply ignore the (annoying) “configure Kotlin in project” popup in IntelliJ. (https://youtrack.jetbrains.com/issue/KT-9275) This works fine for me. (I use gradlew idea to generate the IntelliJ project; don’t know if it make a difference.)

Update: I think the Kotlin compiler version used by IntelliJ is currently tied to the Kotlin plugin version.


#3

That’s what it’s looking like to me. :frowning:

One of my problems is that “Make Project” uses whatever’s baked into the IDE to compile instead of calling the build task. Ergo, IDEA’s hot reload functionality will use whatever version of Kotlin is bundled with the plugin for compilation instead of the actual Gradle dependencies. That said, ./gradlew -w build will continuously rebuild, and I think IDEA will try to hot reload code based on file changes after that build, so that can be a work around for now…


#4

Just to be clear, it looks like Kotlin dependencies (e.g. stdlib) are taken from the compile class path (and therefore from Gradle), but not the compiler itself.