Macros and Functions

maven.repository

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.

url

A string containing the repository url (ex: "https://maven.google.com/").

user

A username for this Maven repository, if it requires authentication (ex: "johndoe").

password

A password for this Maven repository, if it requires authentication (ex: "example-password").


maven.artifact

Generates the data map for a Maven artifact given the available information about its coordinates.

group

The Maven artifact coordinate group name (ex: "com.google.guava").

artifact

The Maven artifact coordinate artifact name (ex: "guava").

version

The Maven artifact coordinate version name (ex: "27.0-jre").

packaging

The Maven packaging specifier (ex: "jar").

classifier

The Maven artifact classifier (ex: "javadoc").

override_license_types

An array of Bazel license type strings to use for this artifact's rules (overrides autodetection) (ex: ["notify"]).

exclusions

An array of exclusion objects to create exclusion specifiers for this artifact (ex: maven.exclusion("junit", "junit")).

Determines if this artifact should be part of the runtime classpath.

testonly

Determines whether this artifact is available for targets not marked as testonly = True.


maven.exclusion

Generates the data map for a Maven artifact exclusion.

group

The Maven group name of the dependency to exclude, e.g. "com.google.guava".

artifact

The Maven artifact name of the dependency to exclude, e.g. "guava".