Having issues when try to integrate with Azure devops extension 5.19.0

Installation is completed with Sonarqube 10.4ver. The issue we are facing when trying to integrate with Azure devops pipeline sonarqube extension 5.19.0

Below is the error we are receiving when trying to integrate, please check and help if there are any known issues.

ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

##[error]The process ‘/home/UATCICDAgent/myagent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.19.0/sonar-scanner/bin/sonar-scanner’ failed with exit code 1

java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Hello and welcome to our community @invschaitanya ,

SonarQube 10.4 requires Java 17 to run the scanner, but it looks like you are using Java 11 to run the analysis currently.

Assuming Java 17 is already installed in the environment running the pipeline, you can re-add the “Run Code Analysis” task and use the dropdown shown in the screenshot below to select Java 17:

Then, your new task definition should look like this:

- task: SonarQubeAnalyze@5
    jdkversion: 'JAVA_HOME_17_X64'

Hope this helps

Hi - We already did all theses. Please find the attached screenshot for the same.

Looks like the issue is with compatibility. We are trying to integrate as part of Azure devops pipeline using plugin is 5.19 which is not supported with java 17.

1 Like

Hello @invschaitanya ,

Thanks for the screenshots

The version of the Azure DevOps extension you are using (5.19.x) supports Java 11. You can see in your first screenshot that the embedded SonarScanner version is 4.8.x, which does support Java 11. The incompatibility comes from your version of SQ (10.4.x) which requires Java 17, but I also notice on your screenshot that Java 11 is used to run the scanner. It should be Java 17.

I suspect that JAVA_HOME_17_X64 is not set in your agent, and that the default JAVA_HOME points to Java 11.

Add this to your pipeline to see what’s currently available in your agent

- task: Bash@3
    targetType: 'inline'
    script: |
      echo "JAVA_HOME_17_X64 $JAVA_HOME_17_X64"
      echo "JAVA_HOME_11_X64 $JAVA_HOME_11_X64"
      echo "JAVA_HOME $JAVA_HOME"
      java -version

Assuming that Java 17 is already installed on your self-hosted agent, please either:

  • Ensure that JAVA_HOME_17_X64 is correctly pointing to your Java 17 (in which case your pipeline config does not need to be changed)

  • Or make JAVA_HOME point to your installed Java 17 and modify your SonarQubeAnalyze task to use JAVA_HOME:

    - task: SonarQubeAnalyze@5
        jdkversion: 'JAVA_HOME'

Hopefully this solves your issue