Skip to content

Incompatible change - Rules which use java_common need to register java toolchain #18970

@kotlaja

Description

@kotlaja

Rules which use java_common need to register @bazel_tools//tools/jdk:toolchain_type.

This is a breaking change for rules which are using java_common and not registering @bazel_tools//tools/jdk:toolchain_type.
The error you might see if you're affected by this change is:
Rule 'custom_rule' in 'location' must declare '@bazel_tools//tools/jdk:toolchain_type' toolchain in order to use java_common.

How to fix this error?
Just register @bazel_tools//tools/jdk:toolchain_type inside rule's toolchains in the rule's definition:

 custom_rule = rule(
    impl = _impl, 
    ...,
    toolchains = ['@bazel_tools//tools/jdk:toolchain_type']
)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions