I have a package com.org.projectname.model in my project. What I want to do is, exclude all the files within this package from SonarQube coverage. I tried,
<exclude>**/model /*.class</exclude>
and <exclude>**/com/org/projectname/model/*.class</exclude>
, still no luck.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<configuration>
<excludes>
<exclude>**/model/ *.class</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>target/coverage-data/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/coverage-data/jacoco-ut.exec</dataFile>
<outputDirectory>target/coverage-reports/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
How to fix this issue? or is there any other way?
CodePudding user response:
Have you tried using sonar.exclusions in your POM properties?
<properties>
<sonar.exclusions>
**/model/*.java
</sonar.exclusions>
</properties>