Spring Maven BOM
Spring provides Maven Bill of Materials (BOM) to automatically resolve appropriate versions for your dependencies. If you use spring maven BOM in your gradle build script, gradle will resolve the best version for your dependencies through spring maven bom.
Release date: January 2021 | Spring Boot: 2.4.x | Revision: 1
Action: Spring Maven BOM
By default, spring applies maven spring boot BOM to your gradle build by applying io.spring.dependency-management plugin.
This plugin includes additional configurations and does not include spring cloud BOM.
Even you will need to explicitly define spring maven BOM, if you are building non bootable jar.
|
Add Spring Maven BOM
To add explicitly spring maven BOM add the following snippet:
build.gradle
dependencies {
implementation enforcedPlatform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") (1)
implementation enforcedPlatform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}") (2)
}
1 | Spring Boot Maven BOM. |
2 | Spring Cloud Maven BOM. |
build.gradle
dependencies {
// Without Applying BOM
implementation "org.projectlombok:lombok:1.18.18" (1)
// By Applying BOM
implementation "org.projectlombok:lombok" (2)
}
1 | Explicit dependency version required without Spring Boot Maven BOM. |
2 | Gradle will resolve appropriate version through Spring Boot Maven BOM. |
By applying spring maven BOM does not guarantee gradle will resolve all dependencies versions. Apart from spring internal dependencies spring helps to resolve few most common dependencies through their maven BOM. |
Learn More
-
Official Doc - Sharing dependency versions between projects
Project Code
-
Github - Spring Maven BOM