Version 2.13.4 has incorrect Java version discovery.
- Dominant language
- CodeQL
- Stars
- 10.1k
- Forks
- 2.1k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 141
Description
I'm using the `setup-java` action in my [config](https://github.com/kubernetes-client/java/blob/master/.github/workflows/codeql-analysis.yml#L32) to set the Java version to 17.
Previous to the 2.13.4 release, this was detected correctly, but starting with the 2.13.4 releases, it is selecting the built-in Java 8 version that is in the github action image.
Output from 2.13.3:
```
/opt/hostedtoolcache/CodeQL/2.13.3-20230524/x64/codeql/codeql version --format=terse
2.13.3
/opt/hostedtoolcache/CodeQL/2.13.3-20230524/x64/codeql/java/tools/autobuild.sh
Picked up JAVA_TOOL_OPTIONS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
[2023-06-22 16:06:11] Build directory is .
[2023-06-22 16:06:12] Java source version 8 detected
[2023-06-22 16:06:12] [WARN] Could not find matching toolchain for source version 8
[2023-06-22 16:06:12] [autobuild] > /home/runner/work/java/java/./mvnw clean package -f "pom.xml" -B -V -e -Dfindbugs.skip -Dcheckstyle.skip -Dpmd.skip=true -Dspotbugs.skip -Denforcer.skip -Dmaven.javadoc.skip -DskipTests -Dmaven.test.skip.exec -Dlicense.skip=true -Drat.skip=true -Dspotless.check.skip=true -t /home/runner/.m2/toolchains.xml
[2023-06-22 16:06:12] [autobuild] Picked up JAVA_TOOL_OPTIONS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
[2023-06-22 16:06:13] [autobuild] Apache Maven 3.8.5 (3599d3414f0[46](https://github.com/kubernetes-client/java/actions/runs/5347790168/jobs/9696787377#step:5:47)de2324203b78ddcf9b5e4388aa0)
[2023-06-22 16:06:13] [autobuild] Maven home: /home/runner/.m2/wrapper/dists/apache-maven-3.8.5-bin/5i5jha092a3i37g0paqnfr15e0/apache-maven-3.8.5
[2023-06-22 16:06:13] [autobuild] Java version: 17.0.7, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/temurin-17-jdk-amd64
[2023-06-22 16:06:13] [autobuild] Default locale: en, platform encoding: UTF-8
[2023-06-22 16:06:13] [autobuild] OS name: "linux", version: "5.15.0-1040-azure", arch: "amd64", family: "unix"
```
Output from 2.3.14:
```
/opt/hostedtoolcache/CodeQL/2.13.4-v2.13.4/x64/codeql/codeql version --format=terse
2.13.4
/opt/hostedtoolcache/CodeQL/2.13.4-v2.13.4/x64/codeql/java/tools/autobuild.sh
Picked up JAVA_TOOL_OPTIONS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
[2023-06-22 02:57:[51](https://github.com/kubernetes-client/java/actions/runs/5347790168/jobs/9696787377#step:5:52)] Build directory is .
[2023-06-22 02:57:[52](https://github.com/kubernetes-client/java/actions/runs/5347790168/jobs/9696787377#step:5:53)] Discovered Java toolchain for version 17.0.0 at /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.7-7/x64 in JAVA_HOME_17_X64
[2023-06-22 02:57:52] Discovered Java toolchain for version 8.0.0 at /usr/lib/jvm/temurin-8-jdk-amd64 in JAVA_HOME_8_X64
[2023-06-22 02:57:52] Discovered Java toolchain for version 11.0.0 at /usr/lib/jvm/temurin-11-jdk-amd64 in JAVA_HOME_11_X64
[2023-06-22 02:57:52] Setting Java version to 8.0.0 (GHA)
[2023-06-22 02:57:52] Setting JAVA_HOME to /usr/lib/jvm/temurin-8-jdk-amd64
[2023-06-22 02:57:52] Adding /usr/lib/jvm/temurin-8-jdk-amd64/bin to PATH
```
Contributor guide
Assessment
This issue has not been assessed yet.