Sonarqube compatibility issue with Java version

Hi Team , I need help i am using Azure devops with maven to build my java project and also using sonarqube for analyzing the code .

My java code has JAXB dependency which can only run with java 8 so i changed my azure devops maven task to run on java 1.8 version but the pipeline fails with sonar incompatibility , any help here is much appreciated ,

Using Java 11 is not an option here , thanks

I tried using -Dsonar.java.source=1.8 in my mvn options but no luck same error .

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project myathlon-nl-restapi-calculations-service: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: 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

 - task: Maven@3
      inputs:
        mavenPomFile: 'pom.xml'
        goals: 'clean install'
        options: '-U -B --settings $(Agent.TempDirectory)/settings_pom.xml -Dsonar.java.source=1.8

thanks

Hey there.

See the documentation on Moving Analysis to Java 11. You may need to separate the build and the analysis, switching the JVM that is used so that the build happens with Java 8 and the analysis happens with Java 11.

Thanks Colin , will check that