I've got a question about code coverage in sonar preview mode.
I'm trying to configure sonar for our project and exploring the sonar's preview and incremental modes. The idea is to run those in continuous manner in CI in feature branches managed by our developers. The goal is to give them a clue of the code quality without overwhelming our sonarcube and its db.
I see that when running the sonar in preview mode it generates a report in json format, since I stick to defaults, it resides in:
target\sonar\sonar-report.json
However this report doesn't contain any information about code coverage, only about violations.
So, my question is how its possible to include the information about the coverage when running sonar in preview and possibly incremental mode?
There are a lot of half-correct answers here in there in internet but I couldn't find a working solution so far.
I use the latest available sonar cube (5.1.2) Maven 3.3.3 is our build tool.
The coverage is jacoco driven, so I run the following commands:
For running the tests themselves
mvn org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent clean install -Pcoverage-per-test
For running the sonar:
mvn sonar:sonar -Dsonar.dynamicAnalysis=reuseReports -Dsonar.analysis.mode=preview -Dsonar.java.coveragePlugin=jacoco
As for the coverage-per-test profile, I've got the following configuration:
<profile>
<id>coverage-per-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- Minimal supported version is 2.4 -->
<version>2.13</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.sonar.java.jacoco.JUnitListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-jacoco-listeners</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
I'm pretty much a newbie in a sonar world so any help will be appreciated.
Thanks a lot in advance