I've got a big issue with the integration of JaCoCo maven plugin for the code covering of SonarQube 6.0.
I've got a multi-module Maven project lets say :
master |--core |--web |--process in the master pom.xml, I've setted a reporting profile like that :
<profile> <id>reporting</id> <build> <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <executions> <execution> <id>pre-unit-test</id> <!--<phase>test</phase> --> <goals> <goal>prepare-agent</goal> </goals> <configuration> <!-- Sets the path to the file to write the execution data to. --> <destFile>${sonar.jacoco.reportPath}</destFile> <!-- Connection with SureFire plugin --> <propertyName>sonarUnitTestArgLine</propertyName> </configuration> </execution> <execution> <id>post-unit-test</id> <phase>test</phase> <goals> <goal>report</goal> </goals> <configuration> <!-- Sets the path to where the execution data is located. --> <dataFile>${sonar.jacoco.reportPath}</dataFile> <!-- Sets the output directory for the code coverage report. --> <outputDirectory>${jacoco.ut.outputdir}</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <forkMode>once</forkMode> <argLine>${sonarUnitTestArgLine} -XX:MaxPermSize=512M -Xms512m -Xmx512m</argLine> </configuration> </plugin> </plugins> </build> </profile> in the childs, I overload the configuration by adding some exclusions :
<!-- First attempt --> <properties> <sonar.jacoco.excludes>**/model/**/*</sonar.jacoco.excludes> </properties> <!-- Second attempt --> <properties> <sonar.coverage.exclusions>**/model/**/*</sonar.coverage.exclusions> </properties> <!-- Third attempt --> <profiles> <profile> <id>reporting</id> <build> <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <configuration> <excludes> <!-- Exclude model classes (POJO's) --> <exclude>**/model/**/*.class</exclude> </excludes> </configuration> </plugin> </plugins> </build> </profile> </profiles> the idea here is to remove the Pojo of the code coverage ( we also do it for other types of Class ...)
When I run the mvn command line :
mvn clean generate-sources install verify -P reporting -fn All my reports are well generated but in Sonar, the exculsions aren't been taking into account ...
Please can you help me fixing this issue ?