Comments (2)
To summarise some points from fmeum's reply on the Bazel issue and my follow-up comment:
It just so happens that Bazel 6 uses a JDK 17 and Bazel 7 uses a JDK 21 for the Java toolchains registered by default. These toolchains use a transition on --java_runtime_version to resolve a matching JDK, which is why you see this additional resolution in the debugger.
It seems this also applies to the versions of rules_java
: 6.3.2
uses Java 17 by default, whilst 7.0.4
uses Java 21.
We can use this to resolve the immediate issue by downgrading to 6.3.2
until the migration is complete. However, it is still unclear to me if (or how) we would force version 7.0.6
to use the Java 17 toolchain, rather than the Java 21 toolchain.
from rules_java.
Thought I would leave my comment here for the record:
bazelbuild/bazel#19934 (comment)
I believe the real fix is to add
[
default_java_toolchain(
name = "toolchain_java%d" % release,
configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,
source_version = "%s" % release,
target_version = "%s" % release,
+ java_runtime = "@bazel_tools//tools/jdk:toolchain_jdk%d" %release,
)
for release in RELEASES
]
And supply the toolchain_jdk for versions 8,9,10,11 (or at least a corresponding @bazel_tools//tools/jdk:remote_jdk{8,9,10}).
This will not work out of the box without it because otherwise you will get
java_runtime attribute of java_toolchain rule @rules_java//toolchains:toolchain_java11: '@bazel_tools//tools/jdk:toolchain_java11' does not have mandatory providers: 'JavaRuntimeInfo'
from rules_java.
Related Issues (20)
- Upgrade from 5.4.0 to 5.5 errors HOT 3
- Dependency on `rules_license` HOT 1
- Problem in version 6.5.0: no such target '@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type' HOT 7
- Flip `incompatible_disallow_empty_glob`
- Add jmods to jdk targets HOT 1
- Add support for JDK 21 HOT 1
- Push a new release containing JDK 21 HOT 14
- Release: rules_java 7.3.1 HOT 1
- JRE logs to stdout and breaks javac/scalac worker on certain environments HOT 2
- rules_java > 7.2.0 incorrectly states it is compatible with Bazel >= 6.4.0 HOT 1
- Provide a way of packaging separate layers into Java container after deprecation of rules_docker HOT 3
- CI postsubmit is broken HOT 3
- Release: rules_java 7.3.2 HOT 4
- rules_java not respecting --tool_java_language_version/--tool_java_runtime_version for test_jar's as of at least 7.1.0 HOT 2
- Turbine native image broke NONPREBUILT_TOOLCHAIN_CONFIGURATION
- Release: rules_java 7.4.0 on BCR HOT 3
- Broken local Java version detection
- Improve performance when running a large number of JUnit tests HOT 1
- java_tools should have prebuilt Linux AArch64 binaries HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_java.