Releases: bazelbuild/rules_jvm_external
2.0.1
Changelog
- Deleted gmaven_rules code and docs. Use the
gmaven_rules
repository to keep using those rules. - POM-only dependencies are now supported.
- Added "neverlink" support: compile-time only dependencies. More information
- Internal change: turn the shell integration tests into java tests
Patch fix for v2.0:
- Fixed an issue while generating BUILD targets
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "2.0.1"
RULES_JVM_EXTERNAL_SHA = "55e8d3951647ae3dffde22b4f7f8dee11b3f70f3f89424713debd7076197eaca"
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 = [
"androidx.test.espresso:espresso-core:3.1.1",
"junit:junit:4.12",
"com.google.inject:guice:4.0",
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
In your BUILD file, reference the targets directly:
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core",
"@maven//:junit_junit",
"@maven//:com_google_inject_guice",
],
)
2.0
NOTE: This release has a bug (#111). Please use v2.0.1 instead.
Changelog
- Delete gmaven code and docs. Use the
gmaven_rules
repository to keep using those rules. - Support pom-only dependencies.
- Internal change: turn the shell integration tests into java tests
- Add "neverlink" support: compile-time only dependencies
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "2.0"
RULES_JVM_EXTERNAL_SHA = "c60ad75370c1416497ec69a0c915d6971644bc77875a2a4b687c9f7cacf2cf30"
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 = [
"androidx.test.espresso:espresso-core:3.1.1",
"junit:junit:4.12",
"com.google.inject:guice:4.0",
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
In your BUILD file, reference the targets directly:
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core",
"@maven//:junit_junit",
"@maven//:com_google_inject_guice",
],
)
1.3
Changelog
- Added support for HTTP proxies using the
http_proxy
environment variable. More information about this. Thanks, @Zetten! - Fixed support for artifact classifier resolution. Thanks, @dgarzon!
- Internal change: the repository rule now downloads the Coursier standalone jar on demand, instead of using a vendored bootstrap jar.
Other changes include new Java Spring Boot and Scala Akka (thanks, @dgarzon) examples.
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "1.3"
RULES_JVM_EXTERNAL_SHA = "63a9162eb8b530da76453857bd3404db8852080976b93f237577f8000287e73d"
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 = [
"androidx.test.espresso:espresso-core:3.1.1",
"junit:junit:4.12",
"com.google.inject:guice:4.0",
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
In your BUILD file, reference the targets directly:
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core",
"@maven//:junit_junit",
"@maven//:com_google_inject_guice",
],
)
1.2
Changelog
- Added support for Kotlin-compiled JARs.
- The generated artifact targets'
tags
attribute now contain the artifacts' original coordinates. More information. - Fixed an issue on Windows where initial runs of the rule fail.
- Added new examples. These include Kotlin and Robolectric projects.
- Added API reference documentation.
- Improved error messages when Coursier fails to download an artifact.
Usage
In your WORKSPACE file, add:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "1.2"
RULES_JVM_EXTERNAL_SHA = "e5c68b87f750309a79f59c2b69ead5c3221ffa54ff9496306937bfa1c9c8c86b"
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 = [
"androidx.test.espresso:espresso-core:3.1.1",
"junit:junit:4.12",
"com.google.inject:guice:4.0",
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
In your BUILD file, reference the targets directly:
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core",
"@maven//:junit_junit",
],
)
Legacy gmaven_rules
This release also contains the legacy gmaven_rules
rules. We will not be including these legacy rules in
upcoming releases.
To keep existing builds working with the legacy @gmaven_rules
external repository, add an additional http_archive
target to the WORKSPACE file:
http_archive(
name = "gmaven_rules",
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,
)
1.1
Changelog
- Fixed an issue on Windows where the Coursier JSON output could not be read.
- Fixed an issue on Windows where the generated BUILD file contained invalid paths.
Usage
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "1.1"
RULES_JVM_EXTERNAL_SHA = "ade316ec98ba0769bb1189b345d9877de99dd1b1e82f5a649d6ccbcb8da51c1f"
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",
"com.google.inject:guice:4.0",
],
repositories = [
# Private repositories are supported through HTTP Basic auth
"http://username:password@localhost:8081/artifactory/my-repository",
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
# Fetch srcjars. Defaults to False.
fetch_sources = True,
)
load("@rules_jvm_external//:defs.bzl", "artifact")
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core", # artifact("androidx.test.espresso:espresso-core"),
"@maven//:junit_junit", # artifact("junit:junit"),
],
)
Legacy gmaven_rules
This release also contains the legacy gmaven_rules
rules. We will not be including these legacy rules in
upcoming releases.
To keep existing builds working with the legacy @gmaven_rules
external repository, add an additional http_archive
target to the WORKSPACE file:
http_archive(
name = "gmaven_rules",
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,
)
1.0
Overview
We're happy to announce the initial release of rules_jvm_external
. This release contains a repository rule to resolve and fetch artifacts transitively from Maven repositories, like Maven Central and Google Maven.
Usage
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "1.0"
RULES_JVM_EXTERNAL_SHA = "48e0f1aab74fabba98feb8825459ef08dcc75618d381dff63ec9d4dd9860deaa"
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",
"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_jvm_external//:defs.bzl", "artifact")
android_library(
name = "test_deps",
exports = [
"@maven//:androidx_test_espresso_espresso_core", # artifact("androidx.test.espresso:espresso-core"),
"@maven//:junit_junit", # artifact("junit:junit"),
],
)
Legacy gmaven_rules
This release also contains the legacy gmaven_rules
rules. We will not be including these legacy rules in
upcoming releases.
To keep existing builds working with the legacy @gmaven_rules
external repository, add an additional http_archive
target to the WORKSPACE file:
http_archive(
name = "gmaven_rules",
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,
)
December 12 2018, Snapshot 2
Add this in your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Google Maven Repository
GMAVEN_TAG = "20181212-2"
http_archive(
name = "gmaven_rules",
strip_prefix = "gmaven_rules-%s" % GMAVEN_TAG,
url = "https://github.com/bazelbuild/gmaven_rules/archive/%s.tar.gz" % GMAVEN_TAG,
)
load("@gmaven_rules//:gmaven.bzl", "gmaven_rules")
gmaven_rules()
Use the gmaven_artifact
macro in your BUILD file:
load("@gmaven_rules//:defs.bzl", "gmaven_artifact")
android_library(
...
deps = [
gmaven_artifact("com.android.support:design:aar:27.0.2"),
gmaven_artifact("com.android.support:support_annotations:jar:27.0.2"),
gmaven_artifact("com.android.support.test.espresso:espresso_core:aar:3.0.1"),
],
)
December 12 2018, Snapshot 1
Add this in your WORKSPACE file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Google Maven Repository
GMAVEN_TAG = "20181212-1"
http_archive(
name = "gmaven_rules",
strip_prefix = "gmaven_rules-%s" % GMAVEN_TAG,
url = "https://github.com/bazelbuild/gmaven_rules/archive/%s.tar.gz" % GMAVEN_TAG,
)
load("@gmaven_rules//:gmaven.bzl", "gmaven_rules")
gmaven_rules()
Use the gmaven_artifact
macro in your BUILD file:
load("@gmaven_rules//:defs.bzl", "gmaven_artifact")
android_library(
...
deps = [
gmaven_artifact("com.android.support:design:aar:27.0.2"),
gmaven_artifact("com.android.support:support_annotations:jar:27.0.2"),
gmaven_artifact("com.android.support.test.espresso:espresso_core:aar:3.0.1"),
],
)
December 6 2018, Snapshot 1
Add this in your WORKSPACE file:
# Google Maven Repository
GMAVEN_TAG = "20181206-1"
http_archive(
name = "gmaven_rules",
strip_prefix = "gmaven_rules-%s" % GMAVEN_TAG,
url = "https://github.com/bazelbuild/gmaven_rules/archive/%s.tar.gz" % GMAVEN_TAG,
)
load("@gmaven_rules//:gmaven.bzl", "gmaven_rules")
gmaven_rules()
Use the gmaven_artifact
macro in your BUILD file:
load("@gmaven_rules//:defs.bzl", "gmaven_artifact")
android_library(
...
deps = [
gmaven_artifact("com.android.support:design:aar:27.0.2"),
gmaven_artifact("com.android.support:support_annotations:jar:27.0.2"),
gmaven_artifact("com.android.support.test.espresso:espresso_core:aar:3.0.1"),
],
)
November 28 2018, Snapshot 1
Add this in your WORKSPACE file:
# Google Maven Repository
GMAVEN_TAG = "20181128-1"
http_archive(
name = "gmaven_rules",
strip_prefix = "gmaven_rules-%s" % GMAVEN_TAG,
url = "https://github.com/bazelbuild/gmaven_rules/archive/%s.tar.gz" % GMAVEN_TAG,
)
load("@gmaven_rules//:gmaven.bzl", "gmaven_rules")
gmaven_rules()
Use the gmaven_artifact
macro in your BUILD file:
load("@gmaven_rules//:defs.bzl", "gmaven_artifact")
android_library(
...
deps = [
gmaven_artifact("com.android.support:design:aar:27.0.2"),
gmaven_artifact("com.android.support:support_annotations:jar:27.0.2"),
gmaven_artifact("com.android.support.test.espresso:espresso_core:aar:3.0.1"),
],
)