Skip to main content

Installation

Follow the steps below to get the library installed in your Kotlin project. It is compatible with both Kotlin 1.x and 2.x.

Add Kotlin KSP

Kotlin Symbol Processing is used to generate code based on the annotations you create.

To add it to your project add this to your plugins section in your build.gradle file:

plugins {
<...>
id("com.google.devtools.ksp") version "2.1.0-1.0.29"
}

Add the dependency

The library is currently distributed through Jitpack, planning to release on Maven Central soon. To install, add this to your build.gradle:

repositories {
<...>
maven { setUrl("https://jitpack.io") }
}

dependencies {
<...>
implementation("com.github.kotgres:kotgres-dsl:v0.1.4")
ksp("com.github.kotgres:kotgres:v0.2.0")
implementation("com.github.kotgres:kotgres:v0.2.0")
}

Add the noarg plugin

Add the noarg compiler plugin to automatically generate no-argument constructor for your entities (Kotgres needs those):

plugins {
<...>
kotlin("plugin.noarg") version "2.1.0"
}

And configure it by adding this anywhere in your build.gradle or build.gradle.kts:

noArg {
annotation("io.kotgres.orm.annotations.Table")
}

Now you can move on to the Quick start section to get your project up and running