I am trying to exclude certain package and classes from Jacoco coverage since they are deprecated. I tried adding exclude
in Jacoco plugin as below but when I look at the Jenkins report on Jenkins, I see all those classes as well not covered and the number of lines including them.
Here is my dir structure for the things I want to ignore.
com/dir1/dir2/dir3/dir4/dir5/XYZScreeningTask.java
com/dir1/dir2/dir3/dir4/dir6/dir7/XYZScreeningData.java
com/dir1/dir2/dir3/dir4/dir8/xyzscreening/BaseXYZFileProcessor.java
com/dir1/dir2/dir3/dir4/dir8/xyzscreening/XYZScreeningFileProcessor.java
com/dir1/dir2/dir3/dir4/dir8/abccmcactivity/AbcCMSActivityProcessor.java
Here is the pattern added below under plugins
<excludes>
<exclude>com/dir1/dir2/dir3/dir4/**/*xyz*/**</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*XYZ*.*</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*abc*/**</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*Abc*.*</exclude>
</excludes>
And here is the plugin info where exclusions has been added.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<excludes>
<exclude>com/dir1/dir2/dir3/dir4/**/*xyz*/**</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*XYZ*.*</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*abc*/**</exclude>
<exclude>com/dir1/dir2/dir3/dir4/**/*Abc*.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>instrument</id>
<phase>process-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>restore</id>
<phase>prepare-package</phase>
<goals>
<goal>restore-instrumented-classes</goal>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>pre-unit-test</id>
<phase>none</phase>
</execution>
<execution>
<id>post-unit-test</id>
<phase>none</phase>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>none</phase>
</execution>
<execution>
<id>post-integration-test</id>
<phase>none</phase>
</execution>
</executions>
</plugin>