maven

TAG CLASSES

amend_artifact

Modifies an artifact with coordinates defined in other tags with additional properties.

Attributes

NameDescriptionTypeMandatoryDefault
name-Nameoptional"maven"
coordinatesCoordinates of the artifact to amend. Only group:artifact are used for matching.Stringrequired
exclusionsMaven artifact tuples, in artifactId:groupId formatList of stringsoptional[]
force_version-BooleanoptionalFalse
neverlink-BooleanoptionalFalse
testonly-BooleanoptionalFalse

artifact

Used to define a single artifact where the simple coordinates are insufficient. Will be added to the other artifacts declared by tags with the same name attribute.

Attributes

NameDescriptionTypeMandatoryDefault
name-Nameoptional"maven"
artifact-Stringrequired
classifier-Stringoptional""
exclusionsMaven artifact tuples, in artifactId:groupId formatList of stringsoptional[]
force_version-BooleanoptionalFalse
group-Stringrequired
neverlink-BooleanoptionalFalse
packaging-Stringoptional""
testonly-BooleanoptionalFalse
version-Stringoptional""

from_toml

Allows a project to import dependencies from a Gradle format libs.versions.toml file.

Attributes

NameDescriptionTypeMandatoryDefault
name-Nameoptional"maven"
bom_modulesList of modules in group:artifact format to treat as BOMs, not artifactsList of stringsoptional[]
libs_versions_tomlGradle libs.versions.toml file to useLabelrequired

install

Combines artifact and bom declarations with setting the location of lock files to use, and repositories to download artifacts from. There can only be one install tag with a given name per module. install tags with the same name across multiple modules will be merged, with the root module taking precedence.

Attributes

NameDescriptionTypeMandatoryDefault
name-Nameoptional"maven"
aar_import_bzl_labelThe label (as a string) to use to import aar_import fromStringoptional"@build_bazel_rules_android//android:rules.bzl"
additional_coursier_optionsAdditional options that will be passed to coursier.List of stringsoptional[]
additional_netrc_linesAdditional lines prepended to the netrc file used by http_file (with maven_install_json only).List of stringsoptional[]
artifactsMaven artifact tuples, in artifactId:groupId:version formatList of stringsoptional[]
bomsMaven BOM tuples, in artifactId:groupId:version formatList of stringsoptional[]
duplicate_version_warningWhat to do if there are duplicate artifacts

If “error”, then print a message and fail the build. If “warn”, then print a warning and continue. If “none”, then do nothing.
Stringoptional"warn"
excluded_artifactsArtifacts to exclude, in artifactId:groupId format. Only used on unpinned installsList of stringsoptional[]
exclusionsMaven artifact tuples, in artifactId:groupId formatList of stringsoptional[]
fail_if_repin_requiredWhether to fail the build if the maven_artifact inputs have changed but the lock file has not been repinned.BooleanoptionalTrue
fail_on_missing_checksum-BooleanoptionalTrue
fetch_javadoc-BooleanoptionalFalse
fetch_sources-BooleanoptionalFalse
generate_compat_repositoriesAdditionally generate repository aliases in a .bzl file for all JAR artifacts. For example, @maven//:com_google_guava_guava can also be referenced as @com_google_guava_guava//jar.BooleanoptionalFalse
ignore_empty_filesTreat jars that are empty as if they were not found.BooleanoptionalFalse
known_contributing_modulesList of Bzlmod modules that are known to be contributing to this repository. Only honoured for the root module.List of stringsoptional[]
lock_file-LabeloptionalNone
repin_instructionsInstructions to re-pin the repository if required. Many people have wrapper scripts for keeping dependencies up to date, and would like to point users to that instead of the default. Only honoured for the root module.Stringoptional""
repositories-List of stringsoptional["https://repo1.maven.org/maven2"]
resolve_timeout-Integeroptional600
resolverThe resolver to use. Only honoured for the root module.Stringoptional"coursier"
strict_visibilityControls visibility of transitive dependencies.

If “True”, transitive dependencies are private and invisible to user‘s rules. If “False”, transitive dependencies are public and visible to user’s rules.
BooleanoptionalFalse
strict_visibility_value-List of labelsoptional["@rules_jvm_external//visibility:private"]
use_credentials_from_home_netrc_fileWhether to pass machine login credentials from the ~/.netrc file to coursier.BooleanoptionalFalse
use_starlark_android_rulesWhether to use the native or Starlark version of the Android rules.BooleanoptionalFalse
version_conflict_policyPolicy for user-defined vs. transitive dependency version conflicts

If “pinned”, choose the user-specified version in maven_install unconditionally. If “default”, follow Coursier's default policy.
Stringoptional"default"

override

Allows specific maven coordinates to be redirected elsewhere. Commonly used to replace an external dependency with another, or a compatible implementation from within this module.

Attributes

NameDescriptionTypeMandatoryDefault
name-Nameoptional"maven"
coordinatesMaven artifact tuple in artifactId:groupId formatStringrequired
targetTarget to use in place of maven coordinatesLabelrequired