I have a ProjectA
with a platform
published to a Maven repository.
I made some constraints in that platform for grpc dependencies:
dependencies {
constraints {
val grpcModules = setOf(
"grpc-all",
"grpc-alts",
"grpc-android",
"grpc-api",
"grpc-auth",
"grpc-benchmarks",
"grpc-binder",
"grpc-census",
"grpc-context",
"grpc-core",
"grpc-cronet",
"grpc-gcp-observability",
"grpc-googleapis",
"grpc-grpclb",
"grpc-inprocess",
"grpc-interop-testing",
"grpc-netty",
"grpc-netty-shaded",
"grpc-okhttp",
"grpc-protobuf",
"grpc-protobuf-lite",
"grpc-rls",
"grpc-services",
"grpc-servlet",
"grpc-servlet-jakarta",
"grpc-stub",
"grpc-testing",
"grpc-testing-proto",
"grpc-util",
"grpc-xds",
"protoc-gen-grpc-java",
)
grpcModules.forEach { artifactId ->
api("io.grpc:$artifactId") {
version {
strictly(getVersion("grpc"))
}
}
}
}
}
When I use this platform in ProjectA
with api(platform(project(":platform")))
everything is OK.
But ProjectB
cannot find a version that satisfies the version constraints:
> Cannot find a version of 'io.grpc:grpc-netty' that satisfies the version constraints:
Dependency path '***' --> '***' (runtimeElements) --> 'dev.openfeature.contrib.providers:flagd:0.6.9' (runtime) --> 'io.grpc:grpc-netty:1.60.1'
Constraint path '***' --> '***' (runtimeElements) --> '***:platform:***' (runtimeElements) --> 'io.grpc:grpc-netty:{strictly 1.58.1}'
Constraint path '***' --> 'io.temporal:temporal-sdk:1.22.3' (runtimeElements) --> 'io.grpc:grpc-bom:1.54.1' (platform-runtime) --> 'io.grpc:grpc-netty:1.54.1'
Why it doesn’t work?
Does it mean that the platform is only list of constraints and somewhere should be specified dependency io.grpc:grpc-netty
with version 1.58.1
?
This only helps in a ProjectB
:
dependencies {
api(enforcedPlatform("***:platform"))
...
}
But why it doesn’t work with api(platform("***:platform"))
?