Here is an instruction excerpt on how to generate test coverage report on
SonarQube dashboard.
------------------------------
### Sonar Report for Test Coverage (with `jacoco` plugin)
------------------------------
1. Add a "sonar" profile in `~/.m2/settings.xml` or `project/pom.xml`
```json
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!--change Œlocalhost¹ & port to your SonarQube server settings -->
<sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?</sonar.jdbc.url>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>
http://localhost:9000
</sonar.host.url>
</properties>
</profile>
```
2. Add `jacoco` plugin to `project/pom.xml`
```json
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.4.201502262128</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals><goal>prepare-agent</goal></goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals><goal>report</goal></goals>
</execution>
<execution>
<id>prepare-integration-test-agent</id>
<goals><goal>prepare-agent-integration</goal></goals>
</execution>
<execution>
<id>generate-integration-test-report</id>
<goals><goal>report-integration</goal></goals>
</execution>
</executions>
</plugin>
```
3. Run maven in command line
```bash
mvn clean test # and/or `mvn -Plive test`
mvn sonar:sonar
```