How to lock the sonar plugin which support for JAVA 8 in pom.xml

My Java project written and compiled in 1.8 through Maven. I am getting the following error when I try to analyze my code using sonar-maven-plugin Ver. 3.9.1.2184 for SonarQube 8.9 LTS

As I mentioned maven plugin version it sutable for JAVA 8 but its Downloadnig latest version plugin:3.9.1.2184:sonar
my sonar plugin is

org.codehaus.mojo
sonar-maven-plugin
2.4

ERROR facing :-

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project iPICK_WEB: 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

[ERROR] -----------------------------------------------------

[ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184

[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar

[ERROR] urls[1] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar

[ERROR] urls[2] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar

[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar

[ERROR] urls[4] = file:/root/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar

[ERROR] urls[5] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar

[ERROR] Number of foreign imports: 1

[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]

[ERROR]

[ERROR] -----------------------------------------------------

[ERROR]

[ERROR] → [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] PluginContainerException - Apache Maven - Apache Software Foundation

The command ‘/bin/sh -c mvn -s /root/.m2/settings.xml sonar:sonar’ returned a non-zero code: 1

##[error]The command ‘/bin/sh -c mvn -s /root/.m2/settings.xml sonar:sonar’ returned a non-zero code: 1

Please Resolved the issue!!!
Thankyou

Hey @Azar

A little formatting can go a long way.

It looks like you’re trying to analyze using Java 8 – while it’s perfectly possible to analyze Java 8 code (and even code built with a JDK 8 runtime), you have to use Java 11 for analysis. The version of the SonarScanner for Maven doesn’t apply here.

Check the documentation on Moving analysis to Java 11 for some help.