Runing Kotlin Script through Gradle

Hello, I am trying to run a .kts file through a Gradle task.
I’ve followed this gist and I managed to get it working on Kotlin version 1.1.0, but when running it with version 1.3.70 it gives back error: unable to evaluate script, no scripting plugin loaded.

I’m not sure what this error means exactly, so any help would be appreciated.

Hello. It means that the dependencies need to be updated for Kotlin 1.3.72. Try this:

dependencies {
    kotlinc(kotlinModule("stdlib"))
    kotlinc(kotlinModule("reflect"))
    kotlinc(kotlinModule("compiler-embeddable"))
    kotlinc(kotlinModule("scripting-compiler-embeddable"))

    scripts(kotlinModule("stdlib"))
}
1 Like

Thang you, fixed it