Search code examples
javamavengoogle-cloud-datastorebazelmaven-jar-plugin

How to let bazel recursively download dependencies by maven_jar in java


I am new to Bazel and would like to implement a Google Cloud Datastore client in Java. I tried to add the google-cloud-datastore jar as a dependency in my Bazel project. I added the maven_jar workspace rule in my WORKSPACE file as follows:

maven_jar(
    name = "google_cloud_datastore",
    artifact = "com.google.cloud:google-cloud-datastore:1.97.0",
)

I found that Bazel could only download the exact google-cloud-datastore classes without other relevant and reliable dependencies as what Maven project does. Could Bazel recursively find and download dependencies based on maven_jar requirements?


Solution

  • You're correct that maven_jar does not download any dependencies recursively. You'll want to use rules_jvm_external for this.