-
Notifications
You must be signed in to change notification settings - Fork 746
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
After setup of Java 17, subprocess still runs with 11 #701
Comments
Hi @headius 👋, |
I believe I have worked around it temporarily by explicitly removing the preinstalled JDK packages, installing the version I need, and proceeding from there. I have no theories as to why it picks up one of the preinstalled JDKs in a subprocess of Maven. |
This installs openjdk-17-jdk as the only system JDK so that if maven subcommands fall back on the system they can still run JRuby build for 17+. It should only get used in that case. See actions/setup-java#701
This installs openjdk-17-jdk as the only system JDK so that if maven subcommands fall back on the system they can still run JRuby build for 17+. It should only get used in that case. See actions/setup-java#701
Hi @headius, |
@priyagupta108 A simpler project probably would not show the same effect, but it might be possible to simulate enough of it by having Maven shell out to a subprocess and see if it picks the wrong JDK. Notice that in my subsequent commits I had to remove all the "wrong" JDKs that were installed by default or they would be selected; it is almost as if something in either Maven or the toolchain around it is defaulting to Given the default set of JDKs, perhaps there's more that setup-ruby could do to make the JDK it installs actually be registered as the default JDK for the system? |
@headius 👋 , Thank you for the detailed explanation. - name: Set alternatives for java and javac
run: |
sudo update-alternatives --set java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/temurin-17-jdk-amd64/bin/javac |
Description:
The JRuby build installs specific versions of JDK to build and run tests with, but it seems like any JRuby subcommand run by the build is picking up a Java 11 install regardless of the setup-java JDK version.
This recently came up here: https://github.com/jruby/jruby/pull/8378/checks#step:2:4079
The JRuby build apparently ran with Java 17 (creating org/jruby/Main with bytecode version 61), but when a later part of the build shells out to run JRuby it appears to run with Java 11 (failing to load JRuby because it supports up to bytecode version 55).
I do not see how it could be picking up Java 11 in the subprocess.
Task version:
"v4"
Platform:
Runner type:
Repro steps:
See failed build here: https://github.com/jruby/jruby/pull/8378/checks#step:2:4079
Expected behavior:
All Java-related commands should run with the setup-java JDK version (17 in this case).
Actual behavior:
It seems that some commands (subprocess run from maven, for example) is picking up Java 11 somewhere.
The text was updated successfully, but these errors were encountered: