Upgraded from 8.9.10 LTS to 9.9 LTS Developer Edition.
Ubunu, Java 17, postgres
SonarScanner version : — sonar-maven-plugin:3.4.1.1168:sonar
maven code compile is done using jdk8 but running maven sonarscan using jdk11. Coverage was 60% before upgrade but after upgrade I get 0% code coverage and quality gate fails.
Here is the pom template. I do not see any jacoco reference in our pom file. So I am assuming surefire plugin or failsafe plugin is used for running tests.
It’s striking to me that your first command includes -DskipTests and your second command includes -DskipITs.
I suppose the -Pcoverage part is supposed to run the unit tests and generate the coverage report?
Can you verify that a coverage report is indeed being created? And being passed in to analysis? Presumably via sonar.coverage.jacoco.xmlReportPaths?
If so, what does your analysis log say about it?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
[WARNING] Some problems were encountered while building the effective model for com.xyz.-test:jar:2.44.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun.java:tools:jar refers to a non-existing file /usr/lib/jvm/java-11-openjdk/../lib/tools.jar. Please verify that you run Maven using a JDK and not just a JRE. @ net.openhft:third-party-bom:3.6.2, /root/.m2/repository/net/openhft/third-party-bom/3.6.2/third-party-bom-3.6.2.pom, line 333, column 29
[WARNING] Some problems were encountered while building the effective model for com.xyz.xxyz:xxyz-test-smart:jar:2.44.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun.java:tools:jar refers to a non-existing file /usr/lib/jvm/java-11-openjdk/../lib/tools.jar. Please verify that you run Maven using a JDK and not just a JRE. @ net.openhft:third-party-bom:3.6.2, /root/.m2/repository/net/openhft/third-party-bom/3.6.2/third-party-bom-3.6.2.pom, line 333, column 29
Looks like my project has some dependency with jdk8 and here is the reference to the thirdparty pom file file which we do not have control.
This looks like a problem external to analysis, although I suppose the SonarQube upgrade prompted you to bump the version of Java you’re analyzing with.
You’ll need to either sort out your pom or compile and test with Java 8 and then run analysis in a new process with Java 11. In the short term the latter may be easier, but in the long term the former is the best route.
if you look at the command I am just running the sonar scan using maven. Here it is still using jdk11 but still looking for tools.jar which is not available in jdk11.