0

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?

Sanjesh M
  • 341
  • 2
  • 6
  • 22

1 Answers1

0

Setting java env using the 'env: {JAVA_PATH}' at task level

- task: SonarQubeAnalyze@4
  env:
    JAVA_HOME: JAVA_HOME 
Sanjesh M
  • 341
  • 2
  • 6
  • 22
  • How did u set this up? I tried this: task: SonarQubeAnalyze@5 env: {JAVA_HOME} and still the error persists – msuzuki May 10 '23 at 21:50
  • Please see the above Ans I edited it with code snippet, It should work for you please verify & confirm – Sanjesh M May 13 '23 at 02:16