Jay Dolan
01/23/2025, 7:32 PMErrors occurred while building effective model from /Users/jdolan/.m2/repository/library-b/1.0.0/library-b-1.0.0.pom:
'dependencies.dependency.version' for library-a is missing. in library-b:1.0.0
Sure enough, when I look at the published library-b.pom
in ~/.m2
, there is no version specified for library-a
. Why? And why does the library-b
build not complain about an unresolved version for library-a
?Jay Dolan
01/23/2025, 7:34 PMimport org.springframework.boot.gradle.plugin.SpringBootPlugin
plugins {
id 'java-platform'
id 'maven-publish'
}
javaPlatform {
allowDependencies()
}
dependencies {
api platform(SpringBootPlugin.BOM_COORDINATES)
constraints {
api project(':baz')
api project(':bat')
}
}
Jay Dolan
01/23/2025, 7:36 PMplugins {
id 'java-platform'
id 'maven-publish'
}
javaPlatform {
allowDependencies()
}
dependencies {
api platform(libraryA.bom)
constraints {
api project(':foo')
api project(':bar')
}
}
Jay Dolan
01/23/2025, 7:37 PMJay Dolan
01/24/2025, 1:24 PMJay Dolan
01/24/2025, 1:24 PMJay Dolan
01/27/2025, 1:47 PMJay Dolan
01/27/2025, 5:20 PMapi platform(libraryA.bom)
, and all library-b modules depend on library-b:core. So why wasn't the libraryA.bom
dependency transitive to them as it should have been? And only missing in projects consuming library-b
, but apparently fine in library-b
itself.Jay Dolan
01/27/2025, 5:20 PMThomas Broyer
01/27/2025, 5:32 PMVampire
01/28/2025, 10:19 AMlibrary-b
modules have the same version at runtime, you want to depend on the BOM on all of them anyway so that at least Gradle consumers automatically get proper version alignment of your modules. See https://blog.gradle.org/alignment-with-gradle-module-metadata for more information. 🙂