Skip to main content

Kotlin SDK

RBS provides first-class Kotlin support with automatic Kotlin compiler and JDK management, Maven-compatible dependency resolution, JUnit 5 auto-inclusion, Spring Boot support, and linting.

Setup

Toolchain

Register both Java and Kotlin toolchains — Kotlin requires a JVM.

Dependencies

Define external packages using kotlin_repository. Uses the same Maven coordinate format as Java.

Rules

kotlin_library

Creates a reusable Kotlin library (JAR).
AttributeTypeDescription
namestringUnique target name (required).
srcslistKotlin source files.
depslistDependencies (local or @external://).
runtime_depslistRuntime-only dependencies (not for compilation).
resourceslistResource files to include in the JAR.

kotlin_binary

Creates an executable Kotlin application.
AttributeTypeDescription
namestringUnique target name (required).
srcslistKotlin source files.
mainstringFully qualified main class (required).
depslistDependencies.
runtime_depslistRuntime-only dependencies.
resourceslistResource files.
javaoptslistJVM options.

kotlin_test

Runs Kotlin tests. JUnit 5 is automatically included.

kotlin_lint / kt_lint

Runs linting on Kotlin source files (supports ktlint).

Example: Kotlin Spring Boot