2
votes

I am using 'jacoco' as a code coverage tool for my application and trying to configure the coverage report through 'Jenkins' to 'SonarQube' but when I am running command 'mvn sonar:sonar' it is giving error.

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project my-project: Metric 'overall_lines_to_cover' should not be computed by a Sensor ->

Properties in pom are

     <properties>
          <java.version>1.8</java.version>
          <sonar.sources>src/main</sonar.sources>
          <sonar.tests>src/test</sonar.tests>
          <runSuite>**/*Test*.class</runSuite>
          <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
          <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
          <sonar.jacoco.reportPath>${project.basedir}/target/coverage-
           reports/jacoco-ut.exec</sonar.jacoco.reportPath>
    </properties>

Sonar Configuration at Jenkins is :

Sonar Configuration

1
If I add property <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>, it starts giving error " Metric 'it_lines_to_cover' should not be computed by a Sensor" , But I do not want to execute integration test and show over SonarQube.Vicky
Found this issue(jira.sonarsource.com/browse/SONARPHP-672) and it seems related to my issue, but the thing is I can not update my SonarQube version.Vicky

1 Answers

1
votes

You will need to update your SonarQube version to 6.3 or above for the solution, without that It wont be possible.