Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Releases: jin/rules_maven

0.1.4

28 Feb 22:03
@jin jin
69916fc
Compare
Choose a tag to compare

New in this release:

  • Added use_unsafe_shared_cache attribute to maven_install. Set this to True 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 the maven.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

14 Feb 18:02
@jin jin
8ea8cba
Compare
Choose a tag to compare

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 and maven_library macros to reference the new java_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

08 Feb 20:54
@jin jin
f1dce45
Compare
Choose a tag to compare

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

23 Jan 08:23
@jin jin
Compare
Choose a tag to compare

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 one maven_install per Android app containing its own version of Guava.
  • Version resolution per maven_install declaration. Coursier will resolve artifact versions within each maven_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 the artifact macro has been renamed to repository_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

23 Jan 08:06
@jin jin
cd4039c
Compare
Choose a tag to compare

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 one maven_install per Android app containing its own version of Guava.
  • Version resolution per maven_install declaration. Coursier will resolve artifact versions within each maven_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

10 Jan 01:38
@jin jin
Compare
Choose a tag to compare

New in 0.0.5:

  • Source JAR support. Add fetch_sources = True to maven_install to also fetch source JARs for requested artifacts. These source JARs will be declared in the srcjar attribute of their respective java_import targets.
  • Removal of Maven Central repository lookup by default. To get the same behavior, add https://repo1.maven.org/maven2 to the repositories attribute in maven_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

02 Jan 17:03
@jin jin
Compare
Choose a tag to compare

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

29 Dec 09:00
@jin jin
Compare
Choose a tag to compare

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

28 Dec 23:39
@jin jin
Compare
Choose a tag to compare

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

28 Dec 21:06
@jin jin
Compare
Choose a tag to compare

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"),
    ],
)