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. for SonarQube 8.9 LTS

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


ERROR facing :-

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project iPICK_WEB: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin: failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin: 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:

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

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

[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/

[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] → [Help 1]


[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] 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!!!

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.