Hello,
I have configured our multi maven module repository so that each module could define different coverage threshold and exclude specific files which we don't want to consider in our coverage.
For example, one of our poms look like this:
<properties>
<!-- JaCoCo thresholds -->
<jacoco.percentage.instruction>0.954</jacoco.percentage.instruction>
</properties>
..
..
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*JavaProjectApiCPModule.class</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
and in the parent pom:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>com.sun.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.percentage.instruction}</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
When I build the modules I get for each one jacoco.exec file and also an index.html report which is generated under target/site/jacoco.
I attached the index.html report which I get in this module and it is exactly what I expected - 100% coverage of 1 class and the other I excluded and I don't see it.
HOWEVER in jenkins, as you can see also in the screenshot, I DO get this other class which I have excluded.
My question is why? Isn't the jacoco jenkins plugin refers to the exclusions from the poms?
I don't want to exclude classes from the jenkins plugin itself because I might have 50 classes I would like to exclude from different modules and want to change it in the poms and not in our job...
Thanks in advance for any help that could clarify my misunderstanding here...
Best Regards