We are using Jenkins to run the sonar. JDK under Jenkins is java 11. SonarQube version - 10.4.1
When we try to run this maven command clean verify under Java 8 and sonar:sonar under java 17, it is giving an error as
“Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project workplace-hub: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar: 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 52.0”
As per the SonarQube doc, Is it possible to build with java 8 and scan using java 17? Please advise. Thanks in advance.