rules_java
8.5.1
published 3 days ago
74 stars
66 forks
14 watchers
Apache License 2.0
public
1 assets
3,453,326 downloads
103 KB
Compatability level 1
E4kgayIIxfM6Bd2W5RcVsIVcSAwIK3u0iJqOB/z/U2w=
Maintained byHemanshu Vadehra
8.5.1
November 22, 2024

Changes since 8.5.0 5890537bfb4810132c698b4d4fde85e68181b617 Release @rules_java v8.5.1 4bebd03eb863bdf17f6701677f25888196a06181 Overhaul @rules_java bzl_library dep graph a22cec1657b9642ebca8c680f3c9fa7e33a8fd01 Update @rules_java release notes f81734bf507bda1e483a3ab42c6a170bf7aa0986 Add links to documentation to the rules_java README

MODULE.bazel setup

bazel_dep(name = "rules_java", version = "8.5.1")

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_java",
    urls = [
        "https://github.com/bazelbuild/rules_java/releases/download/8.5.1/rules_java-8.5.1.tar.gz",
    ],
    sha256 = "1389206b2208c5f33a05dd96e51715b0855c480c082b7bb4889a8e07fcff536c",
)

load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
rules_java_dependencies()

# note that the following line is what is minimally required from protobuf for the java rules
# consider using the protobuf_deps() public API from @com_google_protobuf//:protobuf_deps.bzl
load("@com_google_protobuf//bazel/private:proto_bazel_features.bzl", "proto_bazel_features")  # buildifier: disable=bzl-visibility
proto_bazel_features(name = "proto_bazel_features")

# register toolchains
load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
rules_java_toolchains()

Using the rules See the source.

Deps:
Assets:

rules_java

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible Flags Build status

Java Rules for Bazel https://bazel.build.

Documentation

For a quickstart tutorial, see https://bazel.build/start/java

For slightly more advanced usage, like setting up toolchains or writing your own java-like rules, see https://bazel.build/docs/bazel-and-java

Core Java rules

Add a load like:

load("@rules_java//java:java_library.bzl", "java_library")

to your BUILD / BUILD.bazel / bzl` files

For detailed docs on the core rules, see https://bazel.build/reference/be/java