This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
Releases: jin/rules_maven
Releases · jin/rules_maven
0.1.4
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"),
],
)
0.1.3
New in this release:
- You can now specify detailed repository and artifact specifications with Starlark maps. See documentation on Detailed dependency information specifications
- There are new
library
andmaven_library
macros to reference the newjava_library
target for each artifact. This target exports the referenced artifact and all of its transitive dependencies. This will reduce the number of direct dependencies you have to specify in your Java or Android targets.
Thanks to @davidsantiago for the above features.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.1.3"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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"),
],
)
0.1.2
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.1.2"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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",
],
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")
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"),
],
)
0.1.1
New features:
- Ability to specify multiple
maven_install
declarations in the WORKSPACE to isolate artifact version trees. For example, if you have multiple Android apps that depend on different versions of Guava, you can specify onemaven_install
per Android app containing its own version of Guava. - Version resolution per
maven_install
declaration. Coursier will resolve artifact versions within eachmaven_install
declaration. If it encounters a conflict that it cannot resolve, the repository rule will error out. - Versionless target alias label for each resolved artifact. For example, you can specify
@maven//:junit_junit
instead of@maven//:junit_junit_4_12
. - 3 to 10x faster repository rule execution.
- Since 0.1.0: The
name
parameter in theartifact
macro has been renamed torepository_name
.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.1.1"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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",
],
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")
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"),
],
)
0.1.0
New features:
- Ability to specify multiple
maven_install
declarations in the WORKSPACE to isolate artifact version trees. For example, if you have multiple Android apps that depend on different versions of Guava, you can specify onemaven_install
per Android app containing its own version of Guava. - Version resolution per
maven_install
declaration. Coursier will resolve artifact versions within eachmaven_install
declaration. If it encounters a conflict that it cannot resolve, the repository rule will error out. - Versionless target alias label for each resolved artifact. For example, you can specify
@maven//:junit_junit
instead of@maven//:junit_junit_4_12
. - 3 to 10x faster repository rule execution.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.1.0"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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",
],
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")
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"),
],
)
0.0.5
New in 0.0.5:
- Source JAR support. Add
fetch_sources = True
tomaven_install
to also fetch source JARs for requested artifacts. These source JARs will be declared in thesrcjar
attribute of their respectivejava_import
targets. - Removal of Maven Central repository lookup by default. To get the same behavior, add
https://repo1.maven.org/maven2
to therepositories
attribute inmaven_install
. - Documented private Maven repository authentication using HTTP Basic Auth in the README.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.0.5"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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",
],
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 as well.
# Defaults to False.
fetch_sources = True,
)
and in your BUILD file:
load("@rules_maven//:defs.bzl", "artifact")
android_library(
name = "test_deps",
exports = [
artifact("androidx.test.espresso:espresso-core:3.1.1"),
# or @maven//:androidx_test_espresso_espresso_core_3_1_1
artifact("junit:junit:4.12"),
# or @maven//:junit_junit_4_12
],
)
0.0.4
New in 0.0.4:
- The
@bazel_json
WORKSPACE declaration is no longer required. The JSON parser is now vendored directly in rules_maven.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_MAVEN_TAG = "0.0.4"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
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",
],
repositories = [
"https://bintray.com/bintray/jcenter",
"https://maven.google.com",
],
)
and in your BUILD file:
load("@rules_maven//:defs.bzl", "artifact")
android_library(
name = "test_deps",
exports = [
artifact("androidx.test.espresso:espresso-core:3.1.1"),
# or @maven//:androidx_test_espresso_espresso_core_3_1_1
artifact("junit:junit:4.12"),
# or @maven//:junit_junit_4_12
],
)
0.0.3
New in 0.0.3:
- All targets are now consolidated within the
@maven
repository, instead of having a single repository per top level artifact. This is for performance reasons; we don't want to have duplicate symlinks of the same artifacts. This will also make strict dep specification easier.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
BAZEL_JSON_COMMIT = "0d26dfd8d22c8d5476f1e49f6a9547e0f030fb8f"
# This causes the build to require `--incompatible_disallow_slash_operator=false`.
# See https://github.com/erickj/bazel_json/pull/1
# For convenience, add `build --incompatible_disallow_slash_operator=false` to your .bazelrc.
http_archive(
name = "bazel_json",
strip_prefix = "bazel_json-%s" % BAZEL_JSON_COMMIT,
url = "https://github.com/erickj/bazel_json/archive/%s.zip" % BAZEL_JSON_COMMIT,
)
RULES_MAVEN_TAG = "0.0.3"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
url = "https://github.com/jin/rules_maven/archive/%s.zip" % RULES_MAVEN_TAG,
)
load("@rules_maven//:defs.bzl", "maven_install")
maven_install(
artifacts = [
# Artifact FQN : sha256 (not implemented yet)
"junit:junit:4.12",
"com.google.inject:guice:4.0",
"org.hamcrest:java-hamcrest:2.0.0.0",
"androidx.test.espresso:espresso-core:3.1.1",
"androidx.test:runner:1.1.1",
"androidx.test.ext:junit:1.1.0",
],
repositories = [
"https://bintray.com/bintray/jcenter",
"https://maven.google.com",
],
)
and in your BUILD file:
load("@rules_maven//:defs.bzl", "artifact")
android_library(
name = "my_library",
exports = [
artifact("junit:junit:4.12"),
artifact("com.google.inject:guice:4.0"),
artifact("org.hamcrest:java-hamcrest:2.0.0.0"),
artifact("androidx.test.espresso:espresso-core:3.1.1"),
artifact("androidx.test:runner:1.1.1"),
artifact("androidx.test.ext:junit:1.1.0"),
],
)
0.0.2
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
BAZEL_JSON_COMMIT = "0d26dfd8d22c8d5476f1e49f6a9547e0f030fb8f"
# This causes the build to require `--incompatible_disallow_slash_operator=false`.
# See https://github.com/erickj/bazel_json/pull/1
# For convenience, add `build --incompatible_disallow_slash_operator=false` to your .bazelrc.
http_archive(
name = "bazel_json",
strip_prefix = "bazel_json-%s" % BAZEL_JSON_COMMIT,
url = "https://github.com/erickj/bazel_json/archive/%s.zip" % BAZEL_JSON_COMMIT,
)
RULES_MAVEN_TAG = "0.0.2"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
url = "https://github.com/jin/rules_maven/archive/%s.zip" % RULES_MAVEN_TAG,
)
load("@rules_maven//:defs.bzl", "maven_install")
maven_install(
artifacts = [
# Artifact FQN : sha256 (not implemented yet)
"junit:junit:4.12",
"com.google.inject:guice:4.0",
"org.hamcrest:java-hamcrest:2.0.0.0",
"androidx.test.espresso:espresso-core:3.1.1",
"androidx.test:runner:1.1.1",
"androidx.test.ext:junit:1.1.0",
],
repositories = [
"https://bintray.com/bintray/jcenter",
"https://repo1.maven.org/maven2/org/apache",
"https://maven.google.com",
"https://repo1.maven.org", # this is the default server
],
)
and in your BUILD file:
load("@rules_maven//:defs.bzl", "artifact")
android_library(
name = "my_library",
exports = [
artifact("junit:junit:4.12"),
artifact("com.google.inject:guice:4.0"),
artifact("org.hamcrest:java-hamcrest:2.0.0.0"),
artifact("androidx.test.espresso:espresso-core:3.1.1"),
artifact("androidx.test:runner:1.1.1"),
artifact("androidx.test.ext:junit:1.1.0"),
],
)
0.0.1
Initial release.
Usage example:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
BAZEL_JSON_COMMIT = "0d26dfd8d22c8d5476f1e49f6a9547e0f030fb8f"
# This causes the build to require `--incompatible_disallow_slash_operator=false`.
# See https://github.com/erickj/bazel_json/pull/1
# For convenience, add `build --incompatible_disallow_slash_operator=false` to your .bazelrc.
http_archive(
name = "bazel_json",
strip_prefix = "bazel_json-%s" % BAZEL_JSON_COMMIT,
url = "https://github.com/erickj/bazel_json/archive/%s.zip" % BAZEL_JSON_COMMIT,
)
RULES_MAVEN_TAG = "0.0.1"
http_archive(
name = "rules_maven",
strip_prefix = "rules_maven-%s" % RULES_MAVEN_TAG,
url = "https://github.com/jin/rules_maven/archive/%s.zip" % RULES_MAVEN_TAG,
)
load("@rules_maven//:defs.bzl", "maven_install")
maven_install(
artifacts = {
# Artifact FQN : sha256 (not implemented yet)
"junit:junit:4.12": "",
"com.google.inject:guice:4.0": "",
"org.hamcrest:java-hamcrest:2.0.0.0": "",
"androidx.test.espresso:espresso-core:3.1.1": "",
"androidx.test:runner:1.1.1": "",
"androidx.test.ext:junit:1.1.0": "",
},
repositories = [
"https://bintray.com/bintray/jcenter",
"https://repo1.maven.org/maven2/org/apache",
"https://maven.google.com",
"https://repo1.maven.org", # this is the default server
],
)
and in your BUILD file:
load("@rules_maven//:defs.bzl", "artifact")
android_library(
name = "my_library",
exports = [
artifact("junit:junit:4.12"),
artifact("com.google.inject:guice:4.0"),
artifact("org.hamcrest:java-hamcrest:2.0.0.0"),
artifact("androidx.test.espresso:espresso-core:3.1.1"),
artifact("androidx.test:runner:1.1.1"),
artifact("androidx.test.ext:junit:1.1.0"),
],
)