Install

JVM

Add the repository:

build.gradle
buildscript {
    repositories {
        maven { url "https://dl.bintray.com/kodein-framework/Kodein-DB" }
    }
}
Kodein-DB will eventually be sync’d with JCenter, when it exits beta.

Then add the dependency:

build.gradle
dependencies {
    implementation 'org.kodein.db:kodein-db-jvm:0.3.0-beta'
}
If you are developing a library and not an application, use the artifact org.kodein.db:kodein-db-api-jvm:0.3.0-beta instead, which only provides the Kodein-DB API, and not its implementation.

Furthermore, you need to add the serializer you are going to use. When targetting JVM only, you can use Kryo:

build.gradle
dependencies {
    implementation 'org.kodein.db:kodein-db-serializer-kryo-jvm:0.3.0-beta'
}

Finally, if you are targeting a desktop OS, you must add the OS specific leveldb native build dependency:

build.gradle
dependencies {
    implementation 'org.kodein.db:kodein-leveldb-jni-linux:0.3.0-beta' // 'linux' or 'macos'
}
If you are targeting multiple desktop OS, it is OK to add multiple kodein-leveldb-jni-* dependencies.

Multiplatform and/or Native (Gradle)

Kodein-DB supports the following targets:
iosArm32, iosArm64, iosX64, linuxX64, macosX64, mingwX64

Kodein-DB uses the new gradle native dependency model, which is experimental in gradle. You need to enable it in your settings.gradle file:

settings.gradle
enableFeaturePreview("GRADLE_METADATA")

Then, in your build.gradle file, add the repository:

build.gradle
buildscript {
    repositories {
        maven { url "https://dl.bintray.com/kodein-framework/Kodein-DB" }
    }
}
Kodein-DB will eventually be sync’d with JCenter, when it exits beta.

Then add the dependency:

build.gradle
kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation "org.kodein.db:kodein-db:0.3.0-beta"
            }
        }
    }
}

Thanks to Gradle Metadata, you don’t need to add any additional dependency to your targets.

If you are developing a library and not an application, use the artifact org.kodein.db:kodein-db-api:0.3.0-beta instead, which only provides the Kodein-DB API, and not its implementation.

Furthermore, you need to add the serializer you are going to use. When targetting Multiplatform, you need to use KotlinX Serialization:

build.gradle
kotlin {
    sourceSets {
        commonMain {
            dependencies {
                implementation 'org.kodein.db:kodein-db-serializer-kotlinx:0.3.0-beta'
            }
        }
    }
}