rules_java icon indicating copy to clipboard operation
rules_java copied to clipboard

Question: How to override the remote JDK version

Open ngeor opened this issue 3 years ago • 1 comments
trafficstars

Hi, I'm using remote JDK 11 https://github.com/bazelbuild/rules_java/blob/master/java/repositories.bzl#L154 which currently pulls version 11.0.12. Azul has released a newer version, 11.0.14, which I would like to use.

I'm trying to add this in my project:

    remote_java_repository(
        name = "remotejdk11_macos",
        exec_compatible_with = [
            "@platforms//os:macos",
            "@platforms//cpu:x86_64",
        ],
        sha256 = "fbfe3da2024a170b77efd94946aeb95ffe54377134403f92c682376e1f06e8f5",
        strip_prefix = "zulu11.54.25-ca-jdk11.0.14.1-macosx_x64",
        urls = [
            "https://jfrog.booking.com/artifactory/zulu-remote/zulu11.54.25-ca-jdk11.0.14.1-macosx_x64.tar.gz",
            "https://cdn.azul.com/zulu-embedded/bin/zulu11.54.25-ca-jdk11.0.14.1-macosx_x64.tar.gz",
        ],
        version = "11",
    )

But I still get 11.0.12

How can I override the version provided out of the box?

ngeor avatar Apr 01 '22 15:04 ngeor

How can I override the version provided out of the box?

I don't immediately see any problem with your setup except: The order in the WORKSPACE file is important when specifying the same version multiple times. First one wins.

If this doesn't solve the problem, please provide output of bazel run with --toolchain_resolution_debug flag.

comius avatar Apr 08 '22 06:04 comius

This is now explained in https://bazel.build/docs/bazel-and-java#java-versions

hvadehra avatar May 17 '24 06:05 hvadehra