My apologies for a noob question: I\'m trying to check out how serialization works in Kotlin.
To this end, I created a Gradle project like this:
edi
Finally, figured it out. A BUG in IntelliJ IDEA was foiling my troubleshooting.
Leaving the answer for anyone who might find this question via Google:
build.gradle.kt
needs to be
plugins {
java
kotlin("jvm") version "1.3.71"
kotlin("plugin.serialization") version "1.3.71"
}
repositories {
// artifacts are published to JCenter
jcenter()
}
dependencies {
implementation(kotlin("stdlib", org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0")
}
The official instructions have a buggy version of this: no org.jetbrains.kotlin.config.
However, this is not enough. I was executing "Run" from the Kotlin file. This leads to another error
error: unable to evaluate script, no scripting plugin loaded
due to a nasty bug (as in, I wasted HOURS and HOURS trying to figure out what I was doing wrong) https://youtrack.jetbrains.com/issue/KT-37814
One needs to explicitly execute "Build project".