SonarCloud scanner environment soon to require Java 11+

Hello SonarCloud :sonarcloud: community,

The scanner environment is going to require Java 11+ starting from October 2020. The Eclipse Project is moving to Java 11 in September 2020 and we are relying on ECJ (the Eclipse compiler) for our analyzers. Staying close to the latest ECJ is crucial for analysis stability and for support of all the latest language features, especially since many languages increased their pace of new releases. See MMF-2035 for more details.

All users of the Automatic Analysis feature are already set and don’t have to take any action. For all other setups there is going to be a warning in the SonarCloud UI and the PR summary (inside the ALM’s) if the environment does not meet the necessary version requirement.

In addition, we updated all applicable sample projects to use Java 11 by default. Please take a look if you are unsure on how to upgrade:

The SonarCloud :sonarcloud: Team.

Update 2020-12-09: We moved the end of support date until 1st of February 2021. Additionally, there will be a brownout from 11 January 2021 to 15 January 2021 during which the first analysis run with a scanner using Java versions less than 11 will fail. You can find more information on our documentation.

9 Likes

Do you have any suggestions about where it’s not possible to update?
For example Visual Studio and Xamarin requires OpenJdk 1.8 (Java 8) and will not build on anything above it.

Same at my company, but it’s a 100 plus code bases with 1.8. I’m intending to test moving analysis out of the build jdk and run it in a container. We already use a container in ci for the sonar scanner for non Java projects… I just hope there are no incompatibility issues between files generated/instrumented by jdk 8 and the scanner running in 11.

What should I install on our self hosted Windows DevOps agents since the JRE does not exist anymore? We do not develop applications in Java and probably only need it to run the SonarCloud code analysis. Should we install the OpenJDK http://jdk.java.net/ or the Oracle JDK https://www.oracle.com/java/technologies/javase-downloads.html? I assume the only free option is the OpenJDK?

I installed the OpenJDK which seems to work fine.

1 Like

Can I clarify what will happen post-October - will any projects using Java8 simply not analyse or will it attempt to analyse and fail?

Hi @lorriehall, Post-October clarification for Java 8 projects:
Projects containing Java 8 source code will be able to keep the same build configuration using a JDK8 to produce their binaries (Note: it’s also possible to build a Java 8 project using JDK11). But at the analysis step (sonar-scanner or mvn sonar:sonar or gradle sonarqube…) a JVM version 11 or greater will be required (Note: it’s possible to have a JDK/JVM version 8 and 11 on the same machine). Having this requirement fulfilled, projects containing Java 8 source code will continue to be analyzed as usual.

I think the question is (at least for me), will a gradle build using the sonar plugin and calling the sonar task that is running with jdk 8 fail, or simply skip the analysis (e.g. a WARN vs ERROR). For older release branches of code that we may have to patch before implementing JDK 11, I need to know if their builds must be updated to run w/jdk 11, or if they can be left as is (running w/jdk 8) and simply won’t perform sonar analysis but the gradle task won’t fail? Thanks.

@alban.auzeill can you please clarify my prior question? Thanks

Our project uses Gradle + Java 8. At the moment it’s not possible to migrate over to Java 11.

SonarCloud needs Java 11.

Does anyone know how to setup Bitbucket pipelines where Java 8 is used for building our project and Java 11 is used for SonarCloud analysis?