bazel-contrib / rules_jvm_external

Bazel rules to resolve, fetch and export Maven artifacts
Apache License 2.0
336 stars 256 forks source link

FR: Warnings about deviations from the BOM #1161

Open tharakadesilva opened 5 months ago

tharakadesilva commented 5 months ago

We might be doing a maven.artifact for a coordinate that is coming from a BOM with the same version. Would be nice to get a warning that tells me to start relying on the bom instead of explicitly defining the version.

cheister commented 4 months ago

There is already the duplicate_version_warning option to maven install to warn about duplicate artifact declarations.

I think overriding versions from BOM files is different though and probably not a warning. I put together a PR to log when a BOM version is overridden by an artifact if you use RJE_VERBOSE=1 is that sufficient for finding these cases?

tharakadesilva commented 4 months ago

There is already the duplicate_version_warning option to maven install to warn about duplicate artifact declarations.

Let me tell you a little about the use-case why this came about. We are using the latest Spring Boot BOM (3.3.0) and it has MySQL driver defined at 8.3.0. The latest MySQL driver (8.4.0) brings OTel support and automatically adds spans for tracing and we wanted to use that functionality, so we had an explicit version declaration for it. In the future, I don't want to manage this manually, whenever SB BOM bumps the MySQL version I want to remove the explicit version declaration that I did and start using the BOM for the MySQL driver version.

I think overriding versions from BOM files is different though and probably not a warning. I put together a PR to log when a BOM version is overridden by an artifact if you use RJE_VERBOSE=1 is that sufficient for finding these cases?

Can you share a sample of what a log would look like, please?