# Unable to run scan for java repos which are on version java11

**URL:** <https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333>\
**Category:** SonarQube Server / Community Build\
**Created:** [November 13, 2024, 11:26am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333 "2024-11-13T11:26:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 13, 2024, 11:26am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/1 "2024-11-13T11:26:13Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)  
Upgraded sonarqube server version from 9.9 to 10.7 (DE)  
Scanner version 5.0 ( using java 17 on scanner )
- how is SonarQube deployed: zip, Docker, Helm  
Zip - running on EC2 instance
- what are you trying to achieve  
testing the sonarqube version upgrade from 9.9 to 10.7
- what have you tried so far to achieve this  
Upgraded the version successfully and trying to test different version of java repo scanning (java11/java17/java21 and java8/java1.8)

After upgrading sonarqube server version to 10.7 and upgrading sonar scanner environment to use java version 17 – the sonar scan of java repositories which are on JAVA 11 version are failing… could you please confirm if the newer version of sonarqube server(10.7) and scanner environment (with java version 17) supports scanning of java repos which are on java version 11.

Error:

2024-11-13 16:19:17.092 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project dynamo-beam-framework: 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 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Please assist.

Regards!  
Dev

---

<div class="post-metadata">

**Author:** ![anon40266202](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon40266202](https://community.sonarsource.com/u/anon40266202)\
**Post date:** [November 13, 2024, 11:37am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/2 "2024-11-13T11:37:26Z")

</div>

You may build your projects for Java 8, … 11, only the Sonarqube analysis needs to run  
with Java \>= 17.

> [@Devadakshith](#):
>
> 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 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

this means your Maven CLI runs on Java 11 (class file version 55.0) but it needs to run on  
Java \>= 17 (class file version 61.0).

You should also update the version of your sonar-maven plugin, see

> **[SonarScanner for Maven](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner-for-maven/)**
>
> The SonarScanner for Maven is recommended as the default scanner for Maven projects.

Version 3.9.1 is rather old and your Sonarqube server is on version 10.7.0 LATEST.

---

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 13, 2024, 11:43am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/3 "2024-11-13T11:43:53Z")

</div>

Thanks for the response!

the release notes for 10.7 has below in pre-requisites? [SonarScanner for Maven](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner-for-maven/#prerequisites)

Prerequisites

- Maven 3.2.5+
- At least the minimal version of Java supported by your SonarQube server is in use

so it is possible to scan to java code with version 8/11/17/21 with sonarqube version 10.7 and scanner version 5.0 (given, scanner env using java 17) with updated sonar-maven plugin - Please confirm.

Regards!  
Dev

---

<div class="post-metadata">

**Author:** ![anon40266202](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon40266202](https://community.sonarsource.com/u/anon40266202)\
**Post date:** [November 13, 2024, 11:54am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/4 "2024-11-13T11:54:16Z")

</div>

Yes it is possible and just to be clear

> [@Devadakshith](#):
>
> scanner version 5.0 (given, scanner env using java 17) with updated sonar-maven plugin

you will use either Sonar CLI Scanner (the latest version is 6.2.1) or the  
sonar-maven plugin (latest version is 5.0.0.4389).

While using an older version of the CLI scanner or the sonar-maven plugin might still work,  
i recommend to use the latest version especially if you’re running Sonarqube 10.7.0 LATEST.

---

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 13, 2024, 5:21pm UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/5 "2024-11-13T17:21:58Z")

</div>

Thanks for clearing that up! We’ll update to the latest versions of the CLI or the plugin and give it another shot.

---

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 14, 2024, 2:10pm UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/6 "2024-11-14T14:10:48Z")

</div>

Hello,

```auto
you will use either Sonar CLI Scanner (the latest version is 6.2.1) or the
sonar-maven plugin (latest version is 5.0.0.4389).

```

Upgrading the sonar scanner cli to latest version 6.2.1 is still giving same error.

we have some challenges/blockers to upgrade sonar-maven plugin to latest.

could you please confirm if we we can chose any other version of sonarqube server other than 10.7 that supports scanning of java 21 also compatible with java 11…21 without having to upgrade sonar-maven plugin…

regards!  
Dev

---

<div class="post-metadata">

**Author:** ![anon40266202](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon40266202](https://community.sonarsource.com/u/anon40266202)\
**Post date:** [November 14, 2024, 7:26pm UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/7 "2024-11-14T19:26:35Z")

</div>

> [@Devadakshith](#):
>
> we have some challenges/blockers to upgrade sonar-maven plugin to latest.

What are the blockers ?  
Anyway, if the Sonarqube analysis (the goal sonar:sonar) within your Maven build - also with org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184 - runs with Java \>= 17 all is fine.

We use two different mvn calls for legacy projects, the first does the build for the project on Java 8/11 … and the second call runs with Java 17 for the Sonarqube analysis = mvn sonar:sonar

---

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 19, 2024, 6:31am UTC](https://community.sonarsource.com/t/unable-to-run-scan-for-java-repos-which-are-on-version-java11/130333/8 "2024-11-19T06:31:31Z")

</div>

Hi,

we were able to procure the latest version of the sonar-maven plugin.  
updated the sonar-maven plugin for the repositories that were still running on Java 11 (JDK 11).

Everything seems fine at the moment. Thank you so much for your guidance. Please feel free to close this thread.

Best regards,  
Dev
