bazel-contrib / bazel-contrib/rules_jvm_external
How to depend on artifacts that do not contain default jar file (artifactId-version.jar file)?
- Dominant language
- Java
- Stars
- 373
- Forks
- 301
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 5
Description
There are some artifacts that only publish jars with suffixes. I am not sure if that is a good practice or not but I am trying Bazel for our Gradle project and Gradle handles those artifacts ok.
The specific artifact that is causing issue is app.cash.backfila:service-lib:0.1.4-20230428.1859-83eb314. But I have observed similar problem with com.google.protobuf:protoc:3.21.4, io.grpc:protoc-gen-grpc-java:1.9.1 and io.grpc:protoc-gen-grpc-kotlin:1.3.0.
It seems that rules_jvm_external simply skips an artifact that if artifactId-version.jar is not published: https://github.com/bazelbuild/rules_jvm_external/blob/39dcd72d72769acee2f02b869843259683f346c3/coursier.bzl#L874
I am not sure if this is an issue with rules_jvm_external or coursier. I am happy to file a bug against coursier as well. Should manually download this dependency with http_file?
Coursier command that replicates "file": null:
`cs \
fetch \
app.cash.backfila:service-lib:0.1.4-20230428.1859-83eb314 \
--artifact-type \
jar,json,aar,bundle,eclipse-plugin,exe,orbit,test-jar,hk2-jar,maven-plugin,scala-jar,src,doc \
--quiet \
--no-default \
--json-output-file \
dep-tree.json \
--checksum \
SHA-1,MD5 \
--repository \
https://repo1.maven.org/maven2 \
--default=true \
--cache \
v1`
So one can argue that coursier should change to correctly discover the jar file. Or rules_jvm_external should change to somehow handle this case.
Contributor guide
Research direction
Start with coursier.bzl around line 874 and reproduce the issue using the provided Coursier command and affected Maven coordinates. Compare how rules_jvm_external interprets artifacts when the conventional artifactId-version.jar is absent, and determine whether the resolution belongs in this repository or Coursier. Done means the affected dependencies can be resolved without manual downloads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100