A Kotlin script with *.main.kts
format can easily pull the dependency through the @file:Repository
and @file:DependsOn
annotations.
But I tried something similar with the REPL:
kotlinc-jvm -cp <InstallationPath>/lib/kotlin-main-kts.jar
(specified jar manually just because by default its not loaded)
import kotlin.script.experimental.dependencies.* // just because they aren't imported automatically
@file:Repository("https://dl.bintray.com/<repo-path>")
@file:DependsOn("<dependency-notation>")
com.from.dependency.Class()
It throws: error: unresolved reference: from
Can we possibly use dependencies in REPL? If yes, how? I don't really want to specify the jars manually because if I were to, I'd need to download all its dependencies manually as well which is a terrible solution.
I guess there should be some tooling like pip
for Kotlin REPL, that may make this process easier, and better if we don't really want to setup a whole project with gradle for some testing and stuffs.