Skip to content

Require force_version for root module artifact to take precedence #1423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shs96c
Copy link
Collaborator

@shs96c shs96c commented Jul 21, 2025

There was concern expressed by some owners of sub-modules that deliberately contribute to the maven repo that the behaviour of implicitly overriding artifacts by merely listing them in the root module would lead to users accidentally overriding those values. Instead, require the root module to use force_version to override the specific coordinate, which is more inline with the original intention of force_version.

@shs96c shs96c requested review from jin and cheister as code owners July 21, 2025 10:50
@shs96c
Copy link
Collaborator Author

shs96c commented Jul 21, 2025

Note, this builds on #1422 so only the commits after "fix a thinko" need to be reviewed as part of this PR.

@@ -292,7 +301,7 @@ def _deduplicate_artifacts_with_root_priority(root_artifacts, non_root_artifacts
else:
warning_parts.append(maven_module)

print("WARNING: The following maven modules appear in multiple sub-modules with potentially different versions. " +
print("WARNING: The following coordinates from `%s` appear in multiple sub-modules with potentially different versions. " % name +
"Consider adding one of these to your root module to ensure consistent versions:\n\t%s" %
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this message be updated to tell people they'll need force_version=True for the coordinates in the root module?

@@ -18,6 +18,7 @@ maven.artifact(
exclusions = ["com.google.code.findbugs:jsr305"],
group = "com.google.guava",
version = "31.1-jre",
force_version = True,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should force_version be in sorted order after exclusions?

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