Docs›Languages
Kotlin
In one sentence
KotlinBuild compiles Kotlin and Java side by side, adds the standard library that matches the compiler, tests with JUnit and builds a jar.
Build system
KotlinBuildStart one
plinto create kotlin-service HelloApp (or kotlin-lib)Ships asthe same archive as Java
The project
The layout is Java's: src/, resources/, tst/ and tst-resources/, with .kt and .java files mixed as you like.
plinto.conf
{
name = HelloApp
version = 1.0
build = KotlinBuild
main = helloapp.MainKt # a top-level main in src/helloapp/Main.kt
build-dependencies: {
KotlinBuild = 1.0
Java = 25 # to run the compiler and your tests
Kotlin = 2.4.20 # the compiler
}
test-dependencies: {
JUnitJupiter = 6
}
}
The standard library comes along at the compiler's version, so KotlinStdLib is never declared.
Settings
Everything JavaBuild takes, in configuration/KotlinBuild.config, and:
| Key | What it does |
|---|---|
kotlin.jvm-target |
the JVM version the Kotlin code is compiled for (default: java.release) |
kotlin.compiler-args |
more arguments for the Kotlin compiler |
kotlin.compiler-plugins |
compiler plugins to load |
Libraries, tests and releases
As for Java: Maven artifacts through plinto import maven, JUnit tests in tst/, a jar, and for a program an archive with its own JDK.