rules_jvm_external
rules_jvm_external copied to clipboard
How to depend on artifacts that do not contain default jar file (artifactId-version.jar file)?
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.