This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
New in this release:
- Added
use_unsafe_shared_cache
attribute tomaven_install
. Set this toTrue
to instruct Coursier to download artifacts into a shared cache. By default, Coursier will download artifacts into a directory unique to your current workspace, so artifacts will not be shared. - Added artifact exclusion support via the
exclusions
attribute in themaven.artifact
helper. See the README for more information.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.1.4"
RULES_MAVEN_SHA = "c5b96afd4f80708e9ccfda669375b8c4695738693d5e74bff71ae5a148d37c19"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
sha256 = RULES_MAVEN_SHA,
url = "https://github.com/jin/rules_maven/archive/%s.zip" % RULES_MAVEN_TAG,
)
load("@rules_maven//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"junit:junit:4.12",
"androidx.test.espresso:espresso-core:3.1.1",
"com.google.inject:guice:4.0",
],
repositories = [
# Private repositories are supported through HTTP Basic auth
"http://username:password@localhost:8081/artifactory/my-repository",
"https://bintray.com/bintray/jcenter",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
load("@rules_maven//:defs.bzl", "artifact", "library")
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core",
# or artifact("androidx.test.espresso:espresso-core"),
"@maven//:junit_junit",
# or artifact("junit:junit"),
"@maven//:com_google_inject_guice_lib",
# or library("com.google.inject:guice"),
],
)