bazel-java-tools for Debian
---------------------------

To use this package for offline Java builds with Bazel 7+ (Bzlmod enabled),
you need to instruct Bazel to use the local repository provided by this package
instead of attempting to download it from the internet.

You can do this in two ways:

Option 1: Add to .bazelrc (Recommended)
--------------------------------------
Add the following lines to your project's `.bazelrc` file or your user-wide
`~/.bazelrc`:

    common --override_repository=rules_java~~toolchains~remote_java_tools=/usr/lib/<MULTIARCH>/bazel/java_tools
    common --override_repository=rules_java~~toolchains~remote_java_tools_linux=/usr/lib/<MULTIARCH>/bazel/java_tools

Option 2: Pass as command-line arguments
----------------------------------------
Alternatively, you can pass these overrides directly to the `bazel` command:

    bazel build \
      --override_repository=rules_java~~toolchains~remote_java_tools=/usr/lib/<MULTIARCH>/bazel/java_tools \
      --override_repository=rules_java~~toolchains~remote_java_tools_linux=/usr/lib/<MULTIARCH>/bazel/java_tools \
      //your:target

Replacing <MULTIARCH> with your host's multiarch tuple. You can find it by
running:

    dpkg-architecture -qDEB_HOST_MULTIARCH

Using the system JDK
--------------------
Additionally, to ensure Bazel uses the system JDK instead of attempting to
download one, you should add the following flags (either to `.bazelrc` or
directly to the command line):

    build --java_runtime_version=local_jdk
    build --tool_java_runtime_version=local_jdk
    build --javabase=@bazel_tools//tools/jdk:local_jdk
    build --host_javabase=@bazel_tools//tools/jdk:local_jdk

 -- Debian Bazel Team <bazel-team@lists.launchpad.net>  Fri, 03 Jul 2026 04:31:00 +0000
