Hi everyone! I tried to google this, but can't fin...
# scripting
m
Hi everyone! I tried to google this, but can't find complete answer. Can .kts files contain maven dependencies declaration inside them? Just like in Groovy with
@Grab
annotation. Or this is not implemented yet and I should pick some 3rd-party thing like kscript? It seems fine, but I'd prefer solution from JB of course
i
mgtriffid: You can use the maven resolvers from the
kotlin-script-util
library. It is not out of box though, you’ll need to create your own script launcher, but it is quite easy to do. E.g. have a look at this test - https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-script-util/src/test/kotlin/org/jetbrains/kotlin/script/util/ScriptUtilIT.kt#L92 compiling this script: https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-script-util/src/test/resources/scripts/args-junit-hello-world.kts
m
Thanks Ilya! I'll look into this