Sorry if I repeat my questions:point_up:, but let ...
# scripting
r
Sorry if I repeat my questions☝️, but let me rephrase it: I'm using BasicJvmScriptingHost. It was working on kotlin 1.3.50 Now on 1.4.21 it crash.
Copy code
scriptingHost.eval(
                sourceCode, scriptCompilationConfiguration, scriptEvaluationConfiguration
            )
Any hint how to debug
java.lang.NoClassDefFoundError
or move forward?
n
sounds like that could be caused by a version mismatchin in your dependencies study the output of
gradlew dependencies
and look for inconsistencies in the dependencies of scripting related things.. also .. google the classname that is missing and figure out in what dependency and what version of it it should be. between those versions a lot of things moved or were moved or renamed maybe try to recreate it in a minimal example with just the dependencies you need
r
Thanks, I'll look and see if i can understand the output of
gradlew dependencies
. "google the classname", I guess that is for the gradle ouput, cause I'm not seeing any in the exception log.
n
i think
com/intellij/openapi/util/Disposer
is what it fails to load/ find so now the steps are to figure out where it comes from and why that is going wrong.. my guess is mismatched dependencies versions or missing dependencies
👍 1
r
Thanks, I also think minimal example is a way forward, a bit cumbersome to break out code, but I guess I'll learn something in the process.
i
Maybe you have an embeddable/unshaded jars mismatch. For the background, please read the "Artifacts renaming" seciton in https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/ If for some reason you're including dependencies to the compiler or
kotlin-scripting-compiler
jars directly, consider removing them. It is safer to use "end-user" dependencies, like
kotlin-scripting-jvm-host
, and rely on the transitive dependencies. Please also have a look at the examples in https://github.com/Kotlin/kotlin-script-examples - the project there are set up to demonstrate minimal amount of dependencies you may need for scripting.
🙏 1
r
thank you very much @ilya.chernikov🙏, I can confirm that when removing
Copy code
implementation "org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:$kotlin_version"
from gradle file, it works. (Actually I've actually read the "Artifacts renaming" section but did not get it...) I've been struggling with this for long.
👍 1