Skip to content

Conversation

tharakadesilva
Copy link

@tharakadesilva tharakadesilva commented Jul 4, 2025

Problem

When using GraalVM with non-LTS Java versions (e.g., Java 23), Bazel fails to build Java targets with the error:

ERROR: No matching toolchains found for types @@bazel_tools//tools/jdk:toolchain_type

This occurs because:

  • (My limited understanding) rules_java only provides pre-configured toolchains for LTS Java versions (8, 11, 17, 21)
  • rules_graalvm was only registering runtime toolchains, not compilation toolchains
  • Without a compilation toolchain, Bazel cannot find javac to compile Java source files

Solution

This PR adds automatic registration of Java compilation toolchains for all GraalVM versions, not just LTS ones.


Closes #568

@tharakadesilva tharakadesilva force-pushed the fix/568 branch 2 times, most recently from 0fe13ee to 1325768 Compare July 4, 2025 20:52
Copy link

sonarqubecloud bot commented Jul 4, 2025

@tharakadesilva tharakadesilva marked this pull request as ready for review July 4, 2025 21:00
@tharakadesilva tharakadesilva requested a review from sgammon as a code owner July 4, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use java version > 21 as a toolchain
1 participant