Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure due to rules_jvm_external building librules_jvm_external.jar: error executing Javac command: invalid source release 11 with --enable-preview #511

Closed
lbovet opened this issue Feb 19, 2024 · 3 comments · Fixed by #514
Assignees
Labels
bug Something isn't working build Build, CI, etc. (w.o. #testing) contributors Affects Contributors (not users) help wanted Extra attention is needed

Comments

@lbovet
Copy link
Contributor

lbovet commented Feb 19, 2024

Expected Behavior

it works

Actual Behavior

it dows not work

Steps to Reproduce the Problem

/test.bash

Specifications

$ Bazel testing...
Starting local Bazel server and connecting to it...
 checking cached actions
 checking cached actions
 checking cached actions
Loading: 0 packages loaded
INFO: Analyzed 90 targets (330 packages loaded, 17769 targets configured).
ERROR: /home/shaman/.cache/bazel/_bazel_shaman/7e029ba5ed6d0efe7499c82bac73e821/external/rules_jvm_external~6.0/private/tools/java/com/github/bazelbuild/rules_jvm_external/BUILD:1:13: Building external/rules_jvm_external~6.0/private/tools/java/com/github/bazelbuild/rules_jvm_external/librules_jvm_external.jar (4 source files) [for tool] failed: (Exit 1): java failed: error executing Javac command (from target @@rules_jvm_external~6.0//private/tools/java/com/github/bazelbuild/rules_jvm_external:rules_jvm_external) external/remotejdk21_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 20 arguments skipped)
error: invalid source release 11 with --enable-preview
  (preview language features are only supported for release 21)
Use --verbose_failures to see the command lines of failed build steps.
  • Version:
  • Platform: Ubuntu 18.04
@vorburger vorburger added bug Something isn't working help wanted Extra attention is needed build Build, CI, etc. (w.o. #testing) contributors Affects Contributors (not users) labels Feb 20, 2024
@vorburger vorburger self-assigned this Feb 20, 2024
@vorburger vorburger changed the title build fails (java version?) Build failure due to rules_jvm_external building librules_jvm_external.jar: error executing Javac command: invalid source release 11 with --enable-preview Feb 20, 2024
vorburger added a commit to vorburger/enola that referenced this issue Feb 20, 2024
@vorburger
Copy link
Member

This is pretty weird - I cannot reproduce this on any of my development environments, and it does not affect this project's CI (I have never seen this error before), but @lbovet contributor faces it. So much for "{ Fast, Correct } — Choose two"... 🤣

This builds with Java 21 already, support for which is still fairly new in Bazel (e.g. bazelbuild/bazel#21119).

The way I interpret the error is that rules_jvm_external is compiling something (itself, I think) with Java source 11, but then chokes because we have --enable-preview in its default_java_toolchain...

... but perhaps that's dumb, and that should only ever be used in the javacopts of java_library and java_binary rulez?

#514 may help... @lbovet would you be willing to pull that to see if that happens to do the trick for you?

@vorburger
Copy link
Member

#514 may help... @lbovet would you be willing to pull that to see if that happens to do the trick for you?

@lbovet I've already merged #514 now, so you can just pull the latest and greatest from the main branch!

Re-opening this issue for @lbovet to confirm if this build failure is resolved for him now, with the main branch as-is.

(If you are running into other new problems, please close this issue, and open new one/s for other problems.)

vorburger added a commit that referenced this issue Feb 20, 2024
@vorburger vorburger reopened this Feb 20, 2024
@lbovet
Copy link
Contributor Author

lbovet commented Feb 23, 2024

It works now!!

@lbovet lbovet closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build Build, CI, etc. (w.o. #testing) contributors Affects Contributors (not users) help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants