I am getting null when trying to do ScriptEngineManager().getEngineByExtension("kts")
, whatever I do.
Here is everything I have done:
- I am using JDK 11 with Kotlin JVM 1.4.21
- I am using shadowJar
- I have added the dependencies, like so:
implementation("org.jetbrains.kotlin", "kotlin-script-util", kotlinVersion)
implementation("org.jetbrains.kotlin", "kotlin-script-runtime", kotlinVersion)
implementation("org.jetbrains.kotlin", "kotlin-compiler-embeddable", kotlinVersion)
runtimeOnly("org.jetbrains.kotlin", "kotlin-scripting-compiler-embeddable", kotlinVersion)
- I have called
mergeServiceFiles()
in my shadowJar task settings:
tasks {
shadowJar {
manifest {
attributes["Main-Class"] = "me.diniamo.App"
}
mergeServiceFiles()
}
}
- I have added the file in resources (META-INF/services/javax.script.ScriptEngineFactory) as shown in the example, that’s surely not the problem.
I have been asking in multiple places and have tried everything I could, but I couldn’t get it to work.