Install
JVM
With Gradle
Add the MavenCentral repository:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
dependencies {
implementation 'org.kodein.di:kodein-di:7.9.0'
}
If you are NOT using Gradle 6+, you should declare the use of the Gradle Metadata experimental feature settings.gradle.kts
enableFeaturePreview("GRADLE_METADATA") Or, import the JVM binaries with |
Add the dependency:
<dependencies>
<dependency>
<groupId>org.kodein.di</groupId>
<artifactId>kodein-di-jvm</artifactId>
<version>7.9.0</version>
</dependency>
</dependencies>
Use kodein-di-jvm , as Kotlin/Multiplatform projects does not work with Maven
|
Kotlin/Multiplatform (Gradle)
Kodein-DI supports the following targets: androidArm32, androidArm64, iosArm32, iosArm64, iosX64, linuxArm32Hfp, linuxMips32, linuxMipsel32, linuxX64, macosX64, mingwX64 |
Kodein-DI uses the new gradle native dependency model.
If you are NOT using Gradle 6+, you must declare the use of the Gralde Metadata experimental feature settings.gradle.kts
enableFeaturePreview("GRADLE_METADATA") |
Add the MavenCentral repository:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
kotlin {
sourceSets {
commonMain {
dependencies {
implementation "org.kodein.di:kodein-di:7.9.0"
}
}
}
}
JavaScript (Gradle)
Because Kodein-DI for JavaScript is compiled as a UMD module, it can be imported:
-
In a browser:
-
as an AMD module (for example with RequireJS) (See index.html in the demo project).
-
Directly in an HTML page with a
<script>
tag (See index2.html in the demo project).
-
-
In NodeJS, as a regular CJS module.
Add the MavenCentral repository:
buildscript {
repositories {
mavenCentral()
}
}
Then add the dependency:
dependencies {
compile 'org.kodein.di:kodein-di-js:7.9.0'
}