Jenkins plugin shows different coverage results then configured by Jacoco

64 views
Skip to first unread message

javacov

unread,
Jun 6, 2018, 11:26:40 AM6/6/18
to Jenkins JaCoCo plugin mailing list
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

indexHtmlReport.jpg
JenkinsReport.jpg

Dominik Stadler

unread,
Jun 7, 2018, 3:23:59 AM6/7/18
to jenkins-jacoco-pl...@googlegroups.com
Hi,

the pluing does not look at the pom.xml, there are many more buildsystems, e.g. Gradle, Ant and others and adding support for all those would be very cumbersome. Therefore there are configuration-settings in the build-config in Jenkins where you have to duplicate the exclusions for now.

Dominik.


--
Azért kapta ezt az üzenetet, mert feliratkozott a Google Csoportok „Jenkins JaCoCo plugin mailing list” csoportjára.
Az erről a csoportról és az ahhoz kapcsolódó e-mailekről való leiratkozáshoz küldjön egy e-amailt a(z) jenkins-jacoco-plugin-mailing-list+unsubscribe@googlegroups.com címre.
Ha üzenetet szeretne küldeni ebbe a csoportba, küldjön e-mailt a(z) jenkins-jacoco-plugin-mailing-li...@googlegroups.com címre.
További lehetőségekért látogasson el ide: https://groups.google.com/d/optout.

javacov

unread,
Jun 7, 2018, 1:46:24 PM6/7/18
to Jenkins JaCoCo plugin mailing list
Hi Dominik,

Thank you so much for the clarification on that!
I appreciate it very much!!

Best Regards,
Vered 
 
Reply all
Reply to author
Forward
0 new messages