Skip to content

F43nd1r/bomVersionCatalog

Repository files navigation

BOM Version Catalog

This plugin allows you to combine the type safety of version catalogs with existing BOMs by importing them into version catalogs.

Usage

settings.gradle.kts

import com.faendir.gradle.createWithBomSupport
plugins {
    id("com.faendir.gradle.bom-version-catalog") version "<latest>"
}
dependencyResolutionManagement {
    repositories {
        mavenCentral() // or whichever repository holds your boms
    }
    versionCatalogs {
        createWithBomSupport("libs") {
            fromBom("com.vaadin:vaadin-bom:20.0.1") // either directly specify your bom
            fromBomAlias("springBootBom") // or use definition in toml
            fromBomAliasesMatching(".*Bom") // or use a regex to use all aliases matching it from toml
            version("mockito","3.9.1") // overrides both bom and toml
        }
    }
}

gradle/libs.versions.toml (overrides BOM)

[versions]
springBoot="2.5.1"
querydsl="5.0.0-SNAPSHOT"

[libraries]
springBootBom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "springBoot" }

build.gradle.kts

dependencies {
    implementation(libs.orgSpringframeworkBoot.springBootStarterSecurity) // now you can add any dependency from your bom in a typesafe manner
}