Skip to content
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

rules_jvm_external 6.1 seems to require artifacts or boms list #1132

Open
ted-xie opened this issue May 10, 2024 · 2 comments
Open

rules_jvm_external 6.1 seems to require artifacts or boms list #1132

ted-xie opened this issue May 10, 2024 · 2 comments

Comments

@ted-xie
Copy link

ted-xie commented May 10, 2024

See my repro here: https://github.com/ted-xie/maven_install_bzlmod_onoff. The rules_jvm_external version is 6.1. I am using bazelisk with USE_BAZEL_VERSION=f3133764576d9e9d12d88486d6ec2031beb3ddaf.

I would like to have a single source of truth for maven install artifacts. I would like the MODULE.bazel maven.install() artifact list to be the source of truth.

In this example, I specify the artifact list in MODULE.bazel, generate a lock file, and then in WORKSPACE read that lock file. My expectation is that bazel build commands with --noenable_bzlmod and --enable_bzlmod should work identically.

However, I get a rules_jvm_external error when building with bzlmod disabled:

$ bazelisk build :dummy --noenable_bzlmod

ERROR: An error occurred during the fetch of repository 'my_maven':
[...]

ERROR: An error occurred during the fetch of repository 'my_maven':
[...]
Error in fail: Cannot calculate input hash without artifacts or boms

Meanwhile, the build works correctly with bzlmod disabled:

$ bazelisk build @my_maven//... --enable_bzlmod
INFO: Analyzed 9 targets (102 packages loaded, 3356 targets configured).
INFO: Found 9 targets...
INFO: Elapsed time: 4.431s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
@ted-xie
Copy link
Author

ted-xie commented May 10, 2024

cc @ahumesky

@ted-xie
Copy link
Author

ted-xie commented May 10, 2024

The opposite configuration also yields the same error: If we specify the artifacts list in WORKSPACE, generate the lockfile, and read it in to MODULE.bazel, with rules_jvm_external 6.1 we'll see the same error complaining about the lack of artifacts or boms.

@ted-xie ted-xie changed the title maven_install in WORKSPACE + lockfile generated with bzlmod enabled doesn't work rules_jvm_external 6.1 seems to require artifacts or boms list May 13, 2024
ted-xie added a commit to ted-xie/rules_android that referenced this issue May 13, 2024
Also adds a consistency check between defs.bzl and MODULE.bazel for the
Maven artifacts.

Disables the Maven lockfile for WORKSPACE mode due to
bazelbuild/rules_jvm_external#1134.

Ultimately, this is a workaround to
bazelbuild/rules_jvm_external#1132.
copybara-service bot pushed a commit to bazelbuild/rules_android that referenced this issue May 13, 2024
Also adds a consistency check between defs.bzl and MODULE.bazel for the Maven artifacts.

Disables the Maven lockfile for WORKSPACE mode due to bazelbuild/rules_jvm_external#1134.

Ultimately, this is a workaround to
bazelbuild/rules_jvm_external#1132.
Closes #231

COPYBARA_INTEGRATE_REVIEW=#231 from ted-xie:maven_changes 643e5f1
PiperOrigin-RevId: 633334440
Change-Id: I9de06529495846e3a72a50d394cdf90f6335923b
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

No branches or pull requests

1 participant