Moving from kotlin 1.3.72 to 1.4.0 broke my simple...
# scripting
s
Moving from kotlin 1.3.72 to 1.4.0 broke my simple app. Currently the app parses a dsl string and casts it to a class. Works fine in 1.3.72. I am currently using Kotlin-script-util, kotlin-compiler-embeddable, kotlin-compiler-embeddable. I am now getting Error class not found org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineFactoryBase. Any idea what maven dependencies I am missing/should change to?
i
I guess that you're using JSR-223 (
javax.script
) API, right? In this case you only need to use the
kotlin-scripting-jsr223
dependency now. Here is the example - https://github.com/Kotlin/kotlin-script-examples/tree/1.4.0/jvm/jsr223/jsr223-simple.
s
I tried adding this dependency but I get NoClassDefFound for: org/jetbrains/kotlin/cli/common/repl/KotlinJsr223JvmScriptEngineFactoryBase. In addition do you recommend a different approach to parsing a dsl string into class at runtime other than Jsr223?
i
Please try to use only mentioned dependency, the
script-util
is most probably the cause of the problem you see. Please have a look at the example project I linked above.
The JSR-223 is probably the simplest approach, but for the other approaches, you can check other examples in the repo https://github.com/Kotlin/kotlin-script-examples
s
Thanks you, the suggested projects worked for me. This should be higher in search results as an improvement for Kotlin 1.4.0