Reputation: 530
I am developing a multi module maven project structured as follows:
Parent
|----Client
|----Server
|----End2End
Server is a spring boot application that yields a REST interface. Client is a simple swing application which uses that REST interface, and End2End is a module containing some end to end tests (client/server). Coming inside the real problem, this is my properties in parent pom:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<jacoco.data.file>${project.build.directory}/jacoco.exec</jacoco.data.file>
<jacoco.report.path>${project.reporting.outputDirectory}</jacoco.report.path>
<sonar.language>java</sonar.language>
<sonar.jacoco.reportPaths>${project.reporting.outputDirectory}</sonar.jacoco.reportPaths>
</properties>
And here it is my build section
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<jacocoReports>
<jacocoReport>${project.reporting.outputDirectory}/jacoco.xml</jacocoReport>
</jacocoReports>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<excludes>
<exclude>**/ServerApplication.*</exclude>
<exclude>**/DatabaseGrid.*</exclude>
<exclude>**/WebSecurityConfig.*</exclude>
<exclude>**/App.*</exclude>
<exclude>**/DatabaseGrid.*</exclude>
<exclude>**/GridFromServer.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<!-- binds by default to the phase "initialize" -->
<goal>prepare-agent</goal>
<!-- binds by default to the phase "verify" -->
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I launch a build such as
mvn clean verify coveralls:report
My overall code coverage is correctly reported on coveralls. But when I launch:
mvn clean verify sonar:sonar
The analysis works but code coverage remain always at 0%. I am sure that I'm mistaking something with report paths, jacoco report is in parent/target/jacoco.exec. Can anyone help me?
Upvotes: 1
Views: 6376
Reputation: 10574
<sonar.jacoco.reportPaths>${project.reporting.outputDirectory}</sonar.jacoco.reportPaths>
specifies directory, whereas according to SonarQube documentation should specify exec files.
Upvotes: 2