These are the basic functions to get started.
To use these functions, load them at the top of your BUILD file. For example:
load("@rules_jvm_external//:defs.bzl", "maven_install", "artifact")
A helper macro to translate Maven coordinates into a Bazel target label.
For example:
artifact("com.google.guava:guava") translates into @maven//:com_google_guava_guava
artifact("com.google.guava:guava", repository_name = "custom_maven") translates into @custom_maven//:com_google_guava_guava
Resolves and fetches artifacts transitively from Maven repositories.
This macro runs a repository rule that invokes the Coursier CLI to resolve and fetch Maven artifacts transitively.
Supports URLs with HTTP Basic Authentication, e.g. “https://username:password@example.com”. artifacts optional. default is [] A list of Maven artifact coordinates in the form of group-id:artifact-id:version. fetch_sources optional. default is False Additionally fetch source JARs. use_unsafe_shared_cache optional. default is False Download artifacts into a persistent shared cache on disk. Unsafe as Bazel is currently unable to detect modifications to the cache.
These are helper functions to specify more information about Maven artifacts and repositories in maven_install.
To use these functions, load the maven struct at the top of your BUILD file:
load("@rules_jvm_external//:specs.bzl", "maven")
Generates the data map for a Maven repository specifier given the available information.
If both a user and password are given as arguments, it will include the access credentials in the repository spec. If one or both are missing, it will just generate the repository url.
Generates the data map for a Maven artifact given the available information about its coordinates.
Generates the data map for a Maven artifact exclusion.