It appears .main.kts uses a different way to resol...
# scripting
l
It appears .main.kts uses a different way to resolve maven deps than
kotlin-script-examples
jvm-embeddable-host
. Why is that? The latter is able to resolve dependencies fully, whereas main.kts does not (even with runtime option). E.g. lwjgl3 (opengl) will fail during runtime with main.kts, but not using the jvm-embeddable-host
m
Are you using the same kotlin version for both? I know Kotlin 1.4 changed a bunch of things around dependencies resolutions (cf https://github.com/holgerbrandl/kscript/issues/239#issuecomment-628547025).
l
yes. It seems they use different libraries (?)
something that resolves to ivy for main, and aeather maven library for the demo code.
Looks like
org.apache.ivy
vs
org.apache.maven
, by looking at the source. It's just weird that the demo code uses a seemingly better resolution strategy than the code that ships with the IDE. As a result I can't use `main.kts`directly.
options = arrayOf("scope=compile,runtime")
does not work either. It works to some degree, but I wonder if it cannot handle runtime dependencies of other runtime dependencies.
i
Well, the reason is mostly historical now. For the main.kts we needed a resolver that we could pack in somewhat compact fat jar to distribute along with the cli compiler. So ivy was easier to handle. But (somewhat later) for the officially supported resolving API we wanted to use more stable official maven resolving stack, so the
scripting-dependencies-maven
module is based on it. It has more features and is recommended if you're building your own scripts. But we still haven't found enough time/motivation to port main.kts to it.
👍 2
🙏 1