malliaridis commented on code in PR #3227:
URL: https://github.com/apache/solr/pull/3227#discussion_r2649110602
##########
solr/api/build.gradle:
##########
@@ -61,8 +61,11 @@ resolve {
dependencies {
api platform(project(":platform"))
+ swaggerDeps platform(project(":platform"))
+ api platform(libs.fasterxml.jackson.bom)
Review Comment:
If I remember correct, the issue comes from the way BOMs have to be added to
resolve dependency versions. Our `platform` module goes through our
`libs.versions.toml` file and adds all dependencies via `api [dependency]`.
Later, the module is added as `[configuration] platform(project(":platform"))`
to resolve dependencies.
However, in order for BOMs to take effect in dependency resolution, they
have to be added via `platform([bom-dependency])`. Since we cannot reliably
distinguish BOMs from other dependencies in our current setup, we have to
manually add them.
We might be able to enlist the BOM dependencies in a seperate toml file and
iterate over it in our platform module, so that we can run a different logic in
`platform/build.gradle`, something like:
```groovy
// platform/build.gradle
plugins {
id("java-platform")
}
dependencies {
constraints {
// Current logic
def versionCatalog = rootProject.extensions
.getByType(VersionCatalogsExtension).named("libs")
versionCatalog.libraryAliases.forEach { alias ->
def library = versionCatalog.findLibrary(alias)
api library.get()
}
// Additional new logic
def bomCatalog = rootProject.extensions
.getByType(VersionCatalogsExtension).named("bom") // <--
reference different toml file
bomCatalog.libraryAliases.forEach { alias ->
def library = bomCatalog.findLibrary(alias)
api platform(library.get()) // <-- this line makes the difference
}
}
}
```
And then add only BOM dependencies to `gradle/bom.versions.toml`:
```toml
[versions]
amazon-awssdk = "2.32.31"
fasterxml = "2.20.0"
google-cloud-bom = "0.224.0"
grpc = "1.65.1"
netty = "4.2.6.Final"
opentelemetry = "1.56.0"
[libraries]
amazon-awssdk-bom = { module = "software.amazon.awssdk:bom", version.ref =
"amazon-awssdk" }
fasterxml-jackson-bom = { module = "com.fasterxml.jackson:jackson-bom",
version.ref = "fasterxml" }
google-cloud-bom = { module = "com.google.cloud:google-cloud-bom",
version.ref = "google-cloud-bom" }
grpc-bom = { module = "io.grpc:grpc-bom", version.ref = "grpc" }
netty-bom = { module = "io.netty:netty-bom", version.ref = "netty" }
opentelemetry-bom = { module = "io.opentelemetry:opentelemetry-bom",
version.ref = "opentelemetry" }
```
I did not have enough time back then to experiment with that, but it may
allow us to remove redundant dependencies to BOMs in our modules, like the one
you pointed at.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]