Projects having Zero Code Coverage when scanned along with Java 11 Configs

Problem Statement:
Alert appeared on the project scanned with Java 11: This project was scanned using Java 11 runtime. Starting from 15 Jan 2024, SonarCloud will stop accepting scans that are started with Java 11. We highly recommend moving your configuration to Java 17+.

If there are plans to upgrade Java from 11 to 17 in staged upgrade, we should allow projects to run in 11 until they migrate for brief period of time. Simply marking 0 on code coverage is not a right way of representing score in sonar-it is misleading and giving harsh stop over java 11 are simply result in usage attrition impact. Worth to revisit this decision as it doesn’t have a strategic view of customer base.

Recommendation:
If this decision remain active, why running and scoring zero? Rather it should be updated as ‘Not Scanned’. Both Java upgrade decision and Code Coverage Metrics are reflecting poor quality of Dashboard Management within SonarCloud.

  • ALM used (Bitbucket Cloud)
  • CI system used (Argo CI)
  • Scanner command used when applicable : sonar.java.source=11
  • Languages of the repository: Java 11
  • Steps to reproduce: Run the code scan via Sonar and see Code Coverage as 0
  • Potential workaround: Upgrade to Java 17 (which will take time but work-in-progress)

Hey there.

I don’t understand the connection between the flavor of Java used, and the code coverage. One does not affect the other. I think you’ve observed two behaviors (the warning and the coverage) and assumed the two are connected!

Your scans probably stopped being submitted to SonarCloud after the requirement changed from Java 11 to Java 17. This can probably be fixed just by making sure Java 11 is available in your CI environment, and switching to that distribution before running analysis. You can see some examples here.

If your scans are successful again, and you still don’t have code coverage info, make sure you’ve reviewed the docs on Java test coverage.

Thank you, Colin! CI got Java 11 and couple of microservices are scanned by keeping sonar properties such as,

sonar.java.source=11

But the status errored in sonar as:
This project was scanned using Java 11 runtime. Starting from 15 Jan 2024, SonarCloud will stop accepting scans that are started with Java 11. We highly recommend moving your configuration to Java 17+.

If the Java 11 made available within Sonar to scan part of CI, it should scan the Code Coverage to produce right figure to dashboard based on expected scan coverage. But the code coverage showing ZERO which is not expected here: