Skip to content

4.0

Compare
Choose a tag to compare
@jin jin released this 06 Jan 11:24
· 355 commits to master since this release
8ca81e0

Project update: we have @cheister joining the project as a co-maintainer! Chris has been a regular contributor to this project since the start, and we're happy to have him onboard. Welcome, Chris!

If you are interested in helping us maintain this project, please contact us on the #maven channel on https://slack.bazel.build.

Changelog

New features

  • @cheister updated Coursier to 2.0.7 for #471 (#482)
  • @cheister added a @maven//:outdated tool to check for updated versions of artifacts for a maven_install repository. To use it, run bazel run @maven//:outdated. (#465)
  • @ablyes added the ability to handle @ in usernames. (#457)
  • @gibfahn added the ability to load MavenPublishInfo from defs.bzl. (#440)
  • @gibfahn added a provider to maven_publish targets to export the information being published for improved interoperability with other rules (#439)
  • @divanorama enabled COURSIER_OPTS to be available for the internal coursier invocation (#496)
  • @erickj added a fetch_javadoc attribute to maven_install to fetch javadoc targets, similar to fetch_sources for source jars. (#494) (#495)
  • @dmivankov enabled @unpinned_maven//:pin to be always visible regardless of strict_visibility in order to be used in run-based rules like multirun. (#492)
  • @zacharya19 added google cloud storage support to java_export (#463)
  • @shs96c introduced an optional deps and a setup macro to allow rules_jvm_external to pull in its own external dependencies, like for Google Cloud Storage support (#481)

Bug fixes

  • @shs96c reworked how maven project jars are calculated to correctly include and exclude classes, in the context of situations like Protobuf dependencies and aspects. See the PR for more information. (#475)
  • @cheister fixed Target-Label manifest stamping with a custom AddJarManifestEntry class, which maintains consistent timestamps of the jar manifest to make local and remote caching work correctly.
  • @dmivankov fixed an issue with correctly computing leading zeroes in java_export checksums (#453)
  • @alexeagle fixed the path of jq in @maven//:pin to make it runnable (#454)
  • @dmivankov fixed the spelling of the auth scheme as "Basic" for Artifactory headers (#452)
  • @gibfahn fixed a bug with tags in the java_export rule (#444)
  • @shs96c fixed an issue with --frames, publishing rules on JDK 13 (#460)

Project health

  • @cheister applied a cleanup to use BUILD instead of BUILD.bazel and buildifer these BUILD files (#470)
  • @cheister refactored MergeJar to use JarHelper jar entry timestamp logic (#469)
  • @jin added a regression test to ensure version intervals keep working. (#446)

Usage

In your WORKSPACE file, add:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

RULES_JVM_EXTERNAL_TAG = "4.0"
RULES_JVM_EXTERNAL_SHA = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169"

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    sha256 = RULES_JVM_EXTERNAL_SHA,
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        "junit:junit:4.12",
        "androidx.test.espresso:espresso-core:3.1.1",
        "org.hamcrest:hamcrest-library:1.3",
    ],
    repositories = [
        "https://jcenter.bintray.com/",
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

In your BUILD file, reference the targets directly:

java_library(
    name = "java_test_deps",
    exports = [
        "@maven//:junit_junit",
        "@maven//:org_hamcrest_hamcrest_library",
    ],
)

android_library(
    name = "android_test_deps",
    exports = [
        "@maven//:junit_junit",
        "@maven//:androidx_test_espresso_espresso_core",
    ],
)