I am upgrading SonarQube from 8.9 to 9.8 using ZIP and it does not contain wrapper.conf file and has only sonar.properties file.
{sonar_home}\conf\wrapper.conf
I am using Azure pipelines for code scan after the build task is successful.
My problem is the machines (Azure self-hosted agents) on which the scan is running have default JAVA_HOME set to java8 because applications still use java8. (Java11 is also setup but not set as default) And while scanning (with the help of azure task SonarQubeAnalyze@4) I get the below error
##[error]ERROR: Error during SonarScanner execution
ERROR: Error during SonarScanner execution
INFO: ------------------------------------------------------------------------
##[error]java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
How can I solve this problem without doing extra configuration at the application side?
I was thinking to add the below configuration in wrapper.conf file but SonarQube 9.8 ZIP does not come with this wrapper.conf file.
wrapper.java.command={…java11 path}
For reference: How can I analyze Java 8 code using latest SonarQube free edition that uses Java 11?
Setting java env using the 'env: {JAVA_PATH}' at task level
- task: SonarQubeAnalyze@4
env:
JAVA_HOME: JAVA_HOME