Code coverage 0%

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi team,
One of our user when they try to analyze the code, From the sonar they were not able to see the Code coverage . It is showing as 0%

  • Community Edition
  • Version 8.9.6
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<java.version>1.8</java.version>

<jackson.core.version>2.9.10.8</jackson.core.version>

<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>

<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>

<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

<sonar.sources>src/main</sonar.sources>

<sonar.tests>src/test</sonar.tests>

<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>

<sonar.language>java</sonar.language>

<sonar.exclusions>src/main/java/com/pearson/notes/xconnect/domain/**/*,src/main/java/com/pearson/notes/xconnect/aop/**/*,src/main/java/com/pearson/notes/xconnect/configuration/**/*,src/main/java/com/pearson/notes/xconnect/exception/**/*,src/main/java/com/pearson/notes/xconnect/NotesXConnectApplication.java</sonar.exclusions>

<newrelic.version>7.5.0</newrelic.version>

Hi,

I guess this is a Maven project? Most of what you’ve specified should be picked up automatically from the Maven context (and some of those other properties have no effect). I would start by commenting all those properties out, and seeing what you get from analysis.

Also, looking a little more closely, the JaCoCo path seems odd to me. I don’t believe it should contain ../.

 
HTH,
Ann