Skip to content

BOM Fixes#1506

Merged
shs96c merged 5 commits into
bazel-contrib:masterfrom
confluentinc:vinnybod/bom-fixes
Jan 9, 2026
Merged

BOM Fixes#1506
shs96c merged 5 commits into
bazel-contrib:masterfrom
confluentinc:vinnybod/bom-fixes

Conversation

@vinnybod
Copy link
Copy Markdown
Contributor

@vinnybod vinnybod commented Dec 18, 2025

I started going down this path to close the gap between BOM and POM generation. The three gaps this addresses:

  1. Wasn't substituting version numbers in the dependencies (typically from java_export targets).
  2. Wasn't substituting vesion number for the artifact version in the "dependencies bom"
  3. Exclusions not being added to the BOM

I abstracted some of the code to maven_utils.bzl because there was some common logic between the BOM and POM code. But also to be frank, the code for both of these is a bit hard to follow, so having the smaller functions helps a bit. I have some feeling the the code paths could be combined further.

I added additional BOM tests to check for the behavior.


These are the tests being run against the "old" code.

> bazel test //tests/integration/pom_file:all //tests/integration/maven_bom:all --test_output=errors
INFO: Invocation ID: 640a5c9c-01e7-4969-9e7a-719b9ee2db8a
INFO: Analyzed 217 targets (8 packages loaded, 580 targets configured).
FAIL: //tests/integration/maven_bom:validate-combined-exclusion-dependencies-bom (see /private/var/tmp/_bazel_vrose/75815e558bc24dabf01dddc336a56362/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/tests/integration/maven_bom/validate-combined-exclusion-dependencies-bom/test.log)
INFO: From Testing //tests/integration/maven_bom:validate-combined-exclusion-dependencies-bom:
==================== Test output for //tests/integration/maven_bom:validate-combined-exclusion-dependencies-bom:
23a24,33
>                 <exclusions>
>                     <exclusion>
>                         <groupId>com.google.errorprone</groupId>
>                         <artifactId>error_prone_annotations</artifactId>
>                     </exclusion>
>                     <exclusion>
>                         <groupId>com.google.guava</groupId>
>                         <artifactId>failureaccess</artifactId>
>                     </exclusion>
>                 </exclusions>
FAIL: files "tests/integration/maven_bom/combined-exclusion-bom-dependencies.xml" and "tests/integration/maven_bom/combined-exclusion-bom-dependencies.golden.xml" differ. 
================================================================================
FAIL: //tests/integration/maven_bom:validate-transitive-dependencies-bom (see /private/var/tmp/_bazel_vrose/75815e558bc24dabf01dddc336a56362/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/tests/integration/maven_bom/validate-transitive-dependencies-bom/test.log)
INFO: From Testing //tests/integration/maven_bom:validate-transitive-dependencies-bom:
==================== Test output for //tests/integration/maven_bom:validate-transitive-dependencies-bom:
23c23
<                 <version>$(LIB_VERSION)</version>
---
>                 <version>2.0.0</version>
FAIL: files "tests/integration/maven_bom/transitive-bom-dependencies.xml" and "tests/integration/maven_bom/transitive-bom-dependencies.golden.xml" differ. 
================================================================================
FAIL: //tests/integration/maven_bom:validate-dependencies-bom (see /private/var/tmp/_bazel_vrose/75815e558bc24dabf01dddc336a56362/execroot/_main/bazel-out/darwin_arm64-fastbuild/testlogs/tests/integration/maven_bom/validate-dependencies-bom/test.log)
INFO: From Testing //tests/integration/maven_bom:validate-dependencies-bom:
==================== Test output for //tests/integration/maven_bom:validate-dependencies-bom:
8c8
<     <version>$(VERSION)</version>
---
>     <version>0.0.0-dev</version>
16c16
<                 <version>$(VERSION)</version>
---
>                 <version>0.0.0-dev</version>
FAIL: files "tests/integration/maven_bom/bom-dependencies.xml" and "tests/integration/maven_bom/bom-dependencies.golden.xml" differ. 
================================================================================

Copy link
Copy Markdown
Collaborator

@shs96c shs96c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@shs96c shs96c merged commit 125245e into bazel-contrib:master Jan 9, 2026
6 checks passed
shs96c added a commit to JonathanPerry651/rules_jvm_external that referenced this pull request Feb 3, 2026
* master: (25 commits)
  fix: use forward slash separator in Maven purl format (bazel-contrib#1530)
  Load rules from specific bzl files and add sh_test imports (bazel-contrib#1529)
  Added non-conflicting hash for install files (bazel-contrib#1454)
  Update the maven and coursier resolver tests to create a class index file. (bazel-contrib#1519)
  [ci] Drop Bazel 6 and ensure we run on Bazel 7 and 8 (bazel-contrib#1525)
  Only allow modules specified in known_contributing_modules to contribute artifacts or boms to the root module (bazel-contrib#1523)
  [gradle] Fix false resolution failures when BOM upgrades dependency version (bazel-contrib#1520)
  [gradle] Fix Gradle resolver to respect force_version and include runtime dependencies (bazel-contrib#1516)
  Correctly merge BOMs from non-root modules (bazel-contrib#1518)
  Update more lock files
  Filter test_only artifacts out of artifacts merged into root repos and print a warning when a root artifact version is overridden by a non_root bazel_dep (bazel-contrib#1511)
  Fix SHA mismatch for conflicting dependency versions (bazel-contrib#1513)
  [gradle] Plumb through the force_version attribute (bazel-contrib#1515)
  [gradle] Add dep exclusions to only that dep (bazel-contrib#1514)
  [gradle] Handle aggregating dependencies and relocation version conflicts (bazel-contrib#1512)
  BOM Fixes (bazel-contrib#1506)
  Allow an optional index of dep -> class to be created (bazel-contrib#1492)
  Put files in `ResolutionResult` (bazel-contrib#1484)
  Optimize dependency graph building with O(1) lookups (bazel-contrib#1483)
  Provide a mechanism to list all resolved direct deps for a workspace (bazel-contrib#1510)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants