Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does kotlin-bom library do?

Tags:

gradle

kotlin

I've created new Kotlin project under Gradle. By default it sets this dependencies to the Kotlin-library project. And I wonder what does this kotlin-bom lib do ?

dependencies {
    // Align versions of all Kotlin components
    implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

    // Use the Kotlin JDK 8 standard library.
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

    // Use the Kotlin test library.
    testImplementation("org.jetbrains.kotlin:kotlin-test")

    // Use the Kotlin JUnit integration.
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
like image 673
Yevhenii Nadtochii Avatar asked Jan 17 '20 15:01

Yevhenii Nadtochii


People also ask

What is kotlin bom?

Kotlin Libraries Bill of Materials Kotlin is a statically typed programming language that compiles to JVM byte codes and JavaScript. License. Apache 2.0. Tags. bomkotlin.

What is a library in Kotlin?

An Android library is structurally the same as an Android app module. It can include everything needed to build an app, including source code, resource files, and an Android manifest.


1 Answers

The kotlin-bom artifact is a dependency-only POM that aligns all the Kotlin SDK libraries with the same version.

See the POM content for version 1.5.31 for an example. It uses the POM's dependencyManagement section to depend on the same version of all the Kotlin SDK artifacts, like kotlin-stdlib, kotlin-stdlib-jdk8, kotlin-reflect, kotlin-test, etc.

Description of a BOM:

Software bill of materials (BOMs) don’t specify a dependency on a module or file, but instead are a list of version constraints for other components. They define what is called a platform, which is basically a list of components with specific versions that are known to play well together and/or form a useful unit of functionality. It’s worth mentioning that not all of the dependencies listed in the BOM actually have to be included in your projects — it’s basically a way of saying “If you use any of these modules, use this version”.
-- A deep dive into an initial Kotlin build.gradle.kts

like image 111
Colin D Bennett Avatar answered Sep 26 '22 09:09

Colin D Bennett