-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
I am trying to use grpc-java in an existing project which uses bazel, java, and a bunch of jars from maven. I added this to my WORKSPACE:
load("@grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories(
omit_com_google_guava=True,
)
The problem is that I use the migration-tooling project to add maven jars, and its naming for external jars does not match yours. For example, you call it @com_google_guava[1] but that project uses @com_google_guava_guava[2]. So if I try to use the omits, I get:
no such package '@com_google_guava//jar': The repository could not be resolved
And if I remove the omits, my project references two different versions of guava and I get runtime errors (since this project uses guava 19 and I want 21).
Is it possible to switch the naming of external maven jars to match bazel's tooling?
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.5.0
What JVM are you using (java -version)?
% java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
[1] https://github.com/grpc/grpc-java/blob/master/repositories.bzl#L113
[2]
% bazel run //generate_workspace -- --output_dir /tmp --artifact=com.google.guava:guava:21.0
...
Wrote /tmp/generate_workspace.bzl
% cat /tmp/generate_workspace.bzl
# The following dependencies were calculated from:
#
# generate_workspace --output_dir /tmp --artifact=com.google.guava:guava:21.0
def generated_maven_jars():
native.maven_jar(
name = "com_google_guava_guava",
artifact = "com.google.guava:guava:21.0",
)
def generated_java_libraries():
native.java_library(
name = "com_google_guava_guava",
visibility = ["//visibility:public"],
exports = ["@com_google_guava_guava//jar"],
)