Skip to content

Latest commit

 

History

History
133 lines (99 loc) · 13 KB

File metadata and controls

133 lines (99 loc) · 13 KB

maven

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.amend_artifact(name, coordinates, exclusions, force_version, neverlink, testonly)
maven.artifact(name, artifact, classifier, exclusions, force_version, group, neverlink, packaging,
               testonly, version)
maven.from_toml(name, bom_modules, libs_versions_toml)
maven.install(name, aar_import_bzl_label, additional_coursier_options, additional_netrc_lines,
              artifacts, boms, dependency_index, duplicate_version_warning, excluded_artifacts,
              exclusions, fail_if_repin_required, fail_on_missing_checksum, fetch_javadoc,
              fetch_sources, generate_compat_repositories, ignore_empty_files,
              known_contributing_modules, lock_file, repin_instructions, repositories,
              resolve_timeout, resolver, strict_visibility, strict_visibility_value,
              use_credentials_from_home_netrc_file, use_starlark_android_rules,
              version_conflict_policy)
maven.override(name, coordinates, target)

TAG CLASSES

amend_artifact

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

Attributes

Name Description Type Mandatory Default
name - Name optional "maven"
coordinates Coordinates of the artifact to amend. Only group:artifact are used for matching. String required
exclusions Maven artifact tuples, in artifactId:groupId format List of strings optional []
force_version - Boolean optional False
neverlink - Boolean optional False
testonly - Boolean optional False

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

Name Description Type Mandatory Default
name - Name optional "maven"
artifact - String required
classifier - String optional ""
exclusions Maven artifact tuples, in artifactId:groupId format List of strings optional []
force_version - Boolean optional False
group - String required
neverlink - Boolean optional False
packaging - String optional ""
testonly - Boolean optional False
version - String optional ""

from_toml

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

Attributes

Name Description Type Mandatory Default
name - Name optional "maven"
bom_modules List of modules in group:artifact format to treat as BOMs, not artifacts List of strings optional []
libs_versions_toml Gradle libs.versions.toml file to use Label required

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

Name Description Type Mandatory Default
name - Name optional "maven"
aar_import_bzl_label The label (as a string) to use to import aar_import from String optional "@rules_android//rules:rules.bzl"
additional_coursier_options Additional options that will be passed to coursier. List of strings optional []
additional_netrc_lines Additional lines prepended to the netrc file used by http_file (with maven_install_json only). List of strings optional []
artifacts Maven artifact tuples, in artifactId:groupId:version format List of strings optional []
boms Maven BOM tuples, in artifactId:groupId:version format List of strings optional []
dependency_index If present, when dependencies are resolved this file will contain information the java gazelle plugin can use to more accurately construct build files. The default name should be maven_index.json. Label optional None
duplicate_version_warning What 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.
String optional "warn"
excluded_artifacts Artifacts to exclude, in artifactId:groupId format. Only used on unpinned installs List of strings optional []
exclusions Maven artifact tuples, in artifactId:groupId format List of strings optional []
fail_if_repin_required Whether to fail the build if the maven_artifact inputs have changed but the lock file has not been repinned. Boolean optional True
fail_on_missing_checksum - Boolean optional True
fetch_javadoc - Boolean optional False
fetch_sources - Boolean optional False
generate_compat_repositories Additionally 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. Boolean optional False
ignore_empty_files Treat jars that are empty as if they were not found. Boolean optional False
known_contributing_modules List of Bzlmod modules that are known to be contributing to this repository. Only honoured for the root module. List of strings optional []
lock_file - Label optional None
repin_instructions Instructions 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. String optional ""
repositories - List of strings optional ["https://repo1.maven.org/maven2"]
resolve_timeout - Integer optional 600
resolver The resolver to use. Only honoured for the root module. String optional "coursier"
strict_visibility Controls 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.
Boolean optional False
strict_visibility_value - List of labels optional ["@rules_jvm_external//visibility:private"]
use_credentials_from_home_netrc_file Whether to pass machine login credentials from the ~/.netrc file to coursier. Boolean optional False
use_starlark_android_rules Whether to use the native or Starlark version of the Android rules. Boolean optional False
version_conflict_policy Policy 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.
String optional "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

Name Description Type Mandatory Default
name - Name optional "maven"
coordinates Maven artifact tuple in artifactId:groupId format String required
target Target to use in place of maven coordinates Label required