Hi,
I'am trying to create a BOM for my micro-services so I started to create a multiple module project and a module named platform with this configuration:
apply plugin: 'java-platform'
apply plugin: 'maven-publish'
javaPlatform {
allowDependencies()
}
dependencies {
api platform("org.springframework.boot:spring-boot-dependencies:2.6.8") {
exclude(group: "org.flywaydb")
}
api platform("org.keycloak.bom:keycloak-adapter-bom:19.0.2")
constraints {
project.rootProject.subprojects.forEach { subproject ->
if (subproject.name != "platform") {
api(subproject)
}
}
api "org.keycloak:keycloak-admin-client:19.0.2"
api "com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4"
}
}
publishing {
publications {
release(MavenPublication) {
groupId group
artifactId project.name
version project.version
afterEvaluate { from(components["javaPlatform"]) }
}
}
}
In another micro-service i'm using this platform like so :
dependencies {
implementation(platform("com.my.group:platform:${app_version}"))
implementation "com.my.group:core"
implementation "org.keycloak:keycloak-spring-boot-starter"
implementation "org.keycloak:keycloak-admin-client"
implementation "com.github.ulisesbocchio:jasypt-spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-security"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-starter-mail"
developmentOnly "org.springframework.boot:spring-boot-devtools"
}
$: ./gradlew build
I'm getting this error
* What went wrong:
Execution failed for task ':bootJarMainClassName'.
> Could not resolve all files for configuration ':developmentOnly'.
> Could not find org.springframework.boot:spring-boot-devtools:.
Required by:
project :
My configuration:
./gradlew --version
Gradle 7.5.1
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.9 (Oracle Corporation 11.0.9+7-LTS)
OS: Mac OS X 10.16 x86_64
Comment From: wilkinsona
This is how platforms work in Gradle. developmentOnly does not extend from implementation so the constraints added to implementation by implementation(platform("com.my.group:platform:${app_version}")) have no effect on it. You need to declare the platform dependency in developmentOnly as well.