Hello,
here are the required informations :
- SonarQube version: 7.7.0
- Scanner : org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131
- org.jacoco.jacoco-maven-plugin: 0.8.7
The scanner command is as follow :
mvn -X org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar
-Dsonar.scm.provider=git
-Dsonar.projectKey=[project]
-Dsonar.projectName=[project_name]
-Dsonar.host.url=[sonar_url]
-Dsonar.leak.period=previous_version
-Dsonar.links.scm=[scm _url]
-Dsonar.jacoco.reportPaths=target/jacoco.exec,target/jacoco-it.exec
-Dsonar.cpd.exclusions=[exclusions]
-Dsonar.coverage.exclusions=[exclusions]
-Dsonar.exclusions=[exclusions]
There is no sonar configuration in the project.
There is jacoco configuration in the project :
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jaCoCoArgLine</propertyName>
</configuration>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
In Sonarqube, the configuration of jacoco is as follow :
JaCoCo Reports / Path to the JaCoCo report files containing coverage data by unit tests. The path may be absolute or relative to the project base directory :
- target/jacoco.exec
- target/jacoco-it.exec
My goal is to publish code coverage (and other metrics) in sonarqube.
When the scanner command is run, everything works fine (bugs, code_smell, etcâŚ) but the code coverage, which is always 0 when used from the Jenkins platform.
When used from my own computer, with the same files (.exec), it is OK.
When the scanner command is executed in Jenkins, the following message is displayed :
âBoth âsonar.jacoco.reportPathsâ and âsonar.coverage.jacoco.xmlReportPathsâ were set. âsonar.jacoco.reportPathsâ is deprecated therefore, only âsonar.coverage.jacoco.xmlReportPathsâ will be taken into account.â
which is a mystery as no âsonar.coverage.jacoco.xmlReportPathsâ has been declared in our configuration.
The files are generated by the plugin without problem, and contain correct informations as the scanner command run from my computer works fine.
I know we are not supposed to use the .exec files any more but I read the .xml reports are not read by SonarQube 7.7, and we cannot update Sonarqube (the team responsible wonât hear it).
Why am I getting this message? Am I missing a configuration somewhere?
Thank you in advance for your answer.
Gabriel