How do I properly upgrade the Java version used by sonar-scanner?
I have a open-source project in GitHub, that uses the SonarCloud GitHub Action, and I’ve tried to set up like this (inside the yaml):
- uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '17'
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
Below is the job output from GitHub Action:
export use_embedded_jre=false # attempt to force the usage of JAVA_HOME from github workflow
sonar-scanner --define sonar.cfamily.build-wrapper-output="build_wrapper_output_directory"
shell: /usr/bin/bash -e {0}
env:
BUILD_TYPE: Debug
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
JAVA_HOME: /opt/hostedtoolcache/Java_Oracle_jdk/17/x64
JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Oracle_jdk/17/x64
SONAR_HOST_URL: https://sonarcloud.io
GITHUB_TOKEN: ***
SONAR_TOKEN: ***
INFO: Scanner configuration file: /home/runner/work/spectrum/spectrum/.sonar/sonar-scanner-4.8.0.2856-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/runner/work/spectrum/spectrum/sonar-project.properties
INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.17 Eclipse Adoptium (64-bit)