KEMBAR78
Ensure root module artifacts and boms take precedence with warnings by shs96c · Pull Request #1373 · bazel-contrib/rules_jvm_external · GitHub
Skip to content

Conversation

@shs96c
Copy link
Collaborator

@shs96c shs96c commented Jun 9, 2025

This will also issue a warning if a dependency appears in multiple non-root modules and not in the root module, since that's a cause of conflicts in the final resolution.

As part of this work, I've made sure that the artifacts and boms are consistently stored as structs rather than a mix of strings and structs

@shs96c shs96c requested review from cheister and jin as code owners June 9, 2025 08:58
@shs96c shs96c force-pushed the root-project-wins branch from fd3fa7d to 85311f8 Compare June 9, 2025 09:37
@cheister
Copy link
Collaborator

Feels like this change should have a test or two. Was there a situation where you non-root artifacts taking precedence?

shs96c added 5 commits June 20, 2025 10:15
This will also issue a warning if a dependency appears in multiple
non-root modules and not in the root module, since that's a cause
of conflicts in the final resolution.

As part of this work, I've made sure that the `artifacts` and `boms`
are consistently stored as `structs` rather than a mix of `strings`
and `structs`
@shs96c shs96c force-pushed the root-project-wins branch from 5f9c392 to acf226e Compare June 20, 2025 09:15
* master:
  Update maven-metadata.xml when publishing locally (bazel-contrib#1369)
  Add support for gradle resolver (bazel-contrib#1357)
  Prepare for 6.8 release (bazel-contrib#1380)
@shs96c shs96c enabled auto-merge (squash) June 23, 2025 14:52
@shs96c shs96c merged commit 29c451d into bazel-contrib:master Jun 23, 2025
7 checks passed
@shs96c shs96c deleted the root-project-wins branch June 23, 2025 15:01
shs96c added a commit to jin/rules_jvm_external that referenced this pull request Jul 4, 2025
* master: (39 commits)
  Fix resolution of Android/AAR artifacts with Gradle resolver (bazel-contrib#1395)
  fail_if_repin_required is now True by default and minor improvement to failure message (bazel-contrib#1397)
  Housekeeping before we release 6.8 (bazel-contrib#1384)
  Add dll, dylib and so types to maven package mappings (bazel-contrib#1392)
  [bzlmod] Allow suppressing warning about multiple contributing modules. (bazel-contrib#1393)
  Use the artifact default values when adding them to a struct and add tests for coursier artifacts that have empty versions provided by BOMs and don't inlcude them in outdated (bazel-contrib#1390)
  Allow package exclusions and inclusions in javadocs (bazel-contrib#1293)
  Document well-known issues with `bzlmod` (bazel-contrib#1388)
  Begin documenting the gradle resolver (bazel-contrib#1389)
  Run gradle regression tests in CI (bazel-contrib#1385)
  Modify maven_export to allow exporting zip archives (bazel-contrib#1368)
  Allow root module's override tags to take precedence over the overridees from transitive deps. (bazel-contrib#1381)
  Ensure root module artifacts and boms take precedence with warnings (bazel-contrib#1373)
  Update maven-metadata.xml when publishing locally (bazel-contrib#1369)
  Add support for gradle resolver (bazel-contrib#1357)
  Prepare for 6.8 release (bazel-contrib#1380)
  Remove the Windows `kt_jvm_export` example (bazel-contrib#1383)
  Avoid spurious warnings about poorly formatted artifact coordinates (bazel-contrib#1374)
  Flip `fail_if_repin_required` to `True` by default (bazel-contrib#1371)
  Allow the same coordinate to be overridden in different repos (bazel-contrib#1378)
  ...

repo["additional_coursier_options"] = repo.get("additional_coursier_options", []) + getattr(install, "additional_coursier_options", [])
# For list attributes, concatenate but avoid duplicates (root items first)
for list_attr in ["repositories", "excluded_artifacts", "additional_netrc_lines", "additional_coursier_options"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason deduplicating things in additional_coursier_options? There could be intentionally repeated options, for example --bom, passed on to coursier.

@SanjayVas
Copy link

SanjayVas commented Jul 18, 2025

This only mentions the root module, but shouldn't artifacts in non-root modules also take precedence over the modules they depend on? Basically BFS with the first found using that search taking precedence.

e.g. if C depends on B which depends on A, then I'd expect B's declarations to override A's even if root module C doesn't have the explicit artifacts/BOMs declared.

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.

4 participants