Run Analysis Version 7 Throws error - Unsupported Version

What are you trying to accomplish? :- I am trying to upgrade Sonar Qube task (Prepare, Run and Publish) from version 5.0 to Version 7

  • Support a new language?
  • Extend an existing one? Which one?
  • Add language-agnostic features?
  • Something else?
    When I run the analysis the Run Analysis task gives me error
Calling the SonarScanner CLI...

##[error]Error: LinkageError occurred while loading main class org.sonarsource.scanner.cli.Main

Error: LinkageError occurred while loading main class org.sonarsource.scanner.cli.Main

##[error]java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/cli/Main 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

java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/cli/Main 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

##[error]The SonarScanner did not complete successfully

The SonarScanner did not complete successfully

##[error]14:51:37.006 Post-processing failed. Exit code: 1

14:51:37.006 Post-processing failed. Exit code: 1

##[error][ERROR] SonarQube Server: Error while executing task Analyze: The process 'D:\agents\02\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\7.1.1\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1

##[error]The process 'D:\agents\02\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\7.1.1\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1

We already have Java 17 installed on Sonar Qube Server and is set under Java_home. Same thing still works on version 5.

Sonar Qube version we are using is Enterprise Edition 9.9.3 and planning to upgrade this to 2025.1 after this

We have intergrated tSonar Qube in our Azure DevOps Server.

What’s your specific coding challenge in developing your plugin?

And, if relevant, please share the code that’s giving you problems:

Thsi is what is installed on SQ Server
image

image

Java Version on all Build agents and Sopnar Qube Server:-

image

Hi,

If you run java --version on a command line, what do you get?

 
Ann

On Sonar Qube Server:-

java 17.0.6 2023-01-17 LTS
Java™ SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot™ 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

On ADO Build agents:-

java 17.0.6 2023-01-17 LTS
Java™ SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot™ 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

Hi,

Can you echo %JAVA_HOME% on a command line & see if it points to Java 8?

 
Thx,
Ann

On Build Agents

it returns

echo %JAVA_HOME%
C:\Program Files\Java\jdk-17

On Sonar Qube Server

Its not set so not returing anything, Do we need to to set it to same path

Hi,

What’s your analysis command? And what version of the scanner are you trying to use?

 
Ann