Installation
The Kreator library is delivered in two main modules. Both of these modules are deployed to the Maven Central repository. The first module kreator-annotations contains annotation definitions and is delivered as KMP compatible, therefore it has an artifact for each platform separately. The second module kreator-compiler contains an annotation processor for code generation. The KSP tool is used for annotation processing and the Kotlin-Poet library is used for code generation.
Gradle repositories
Add the following code to your settings.gradle.kts.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
KSP plugin
Adding the plugin in the build.gradle file.
plugins {
kotlin("jvm") version "2.1.10"
id("com.google.devtools.ksp") version "2.1.10-1.0.29"
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.1.10'
id 'com.google.devtools.ksp' version '2.1.10-1.0.29'
}
[versions]
kotlin = "2.1.10"
ksp = "2.1.10-1.0.29"
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
plugins {
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.ksp)
}
Setup for standard Kotlin application
Using the library in the build.gradle file.
dependencies {
implementation("cz.petrchatrny.kreator.kreator-annotations:0.0.3")
ksp("cz.petrchatrny.kreator:kreator‐compiler:0.0.3")
}
dependencies {
implementation 'cz.petrchatrny.kreator:kreator-annotations:0.0.3'
ksp 'cz.petrchatrny.kreator:kreator-compiler:0.0.3'
}
[versions]
kreator = "0.0.3"
[libraries]
kreator-annotations = { module = "cz.petrchatrny.kreator:kreator-annotations", version.ref = "kreator" }
kreator-compiler = { module = "cz.petrchatrny.kreator:kreator-compiler", version.ref = "kreator" }
dependencies {
implementation(libs.kreator.annotations)
ksp(libs.kreator.compiler)
}
Setup for KMP application
As stated in the official Kotlin documentation, the use of the KSP tool in a KMP project must be defined separately for each target.
sourceSets {
commonMain {
dependencies {
implementation("cz.petrchatrny.kreator.annotations:0.0.3")
}
}
}
dependencies {
add("kspCommonMainMetadata", "cz.petrchatrny.kreator:compiler:0.0.3")
add("kspAndroid", "cz.petrchatrny.kreator.compiler:0.0.3")
add("kspIosX64", "cz.petrchatrny.kreator.compiler:0.0.3")
add("kspIosArm64", "cz.petrchatrny.kreator.compiler:0.0.3")
// other targets...
}
sourceSets {
commonMain {
dependencies {
implementation 'cz.petrchatrny.kreator.annotations:annotations:0.0.3'
}
}
}
dependencies {
add 'kspCommonMainMetadata', 'cz.petrchatrny.kreator:compiler:0.0.3'
add 'kspAndroid', 'cz.petrchatrny.kreator:compiler:0.0.3'
add 'kspIosX64', 'cz.petrchatrny.kreator:compiler:0.0.3'
add 'kspIosArm64', 'cz.petrchatrny.kreator:compiler:0.0.3'
// other targets...
}
[versions]
kreator = "0.0.3"
[libraries]
kreator-annotations = { module = "cz.petrchatrny.kreator:kreator-annotations", version.ref = "kreator" }
kreator-compiler = { module = "cz.petrchatrny.kreator:kreator-compiler", version.ref = "kreator" }
sourceSets {
commonMain {
dependencies {
implementation(libs.kreator.annotations)
}
}
}
dependencies {
add("kspCommonMainMetadata", libs.kreator.compiler)
add("kspAndroid", libs.kreator.compiler)
add("kspIosX64", libs.kreator.compiler)
add("kspIosArm64", libs.kreator.compiler)
// other targets...
}
26 July 2026