Kotlin script runner.
Enables Kotlin scripts to be invoked with external maven dependencies and no prior software requirements (except for a JRE).
Artifacts are available through JFrog artifactory.
repositories {
maven { url "https://ais.jfrog.io/artifactory/ais-gradle-dev-local/"} // SNAPSHOTS
maven { url "https://ais.jfrog.io/artifactory/ais-gradle-release-local/"} // STABLE
}
dependencies {
implementation "info.laht.kts:host:$version"
}
The following script named example.kts
can be invoked by directly invoking ./example.kts
in a shell.
#!kts
@file:DependsOn("com.google.code.gson:gson:2.8.6")
import com.google.gson.Gson
println(Gson())
Alternatively, invoke ./kts example.kts
.
Custom repositories may be added like so:
@file:Repository("https://some.repo.com/maven")
mavenCentral
is available by default.
The Command Line Application kts
can be built by invoking ./gradlew installDist
You might want to use kotlin-main-kts >= 1.4.0 instead of this if you don't need transitive dependencies.
It provides autocompletion in IntelliJ and script caching. Adding kotlin
from the Kotlin compiler distribution is just as easy as downloading kts
.