Exclusions not working in Jenkins Jacoco FT coverage

3,744 views
Skip to first unread message

raj.my...@gmail.com

unread,
Nov 23, 2017, 5:19:51 AM11/23/17
to JaCoCo and EclEmma Users
Hi,

I am trying to exclude some packages and classes from jacoco coverage report, yet I see them.
I was trying to exclude **/com/module/package2/MyClass* which is a class and **/com/module/package/** which is a package.

1. I put them comma separated in Jenkins plugin for Jacoco in Exclusions box, yet I am seeing them in coverage.
In console, I am seeing though: [JaCoCo plugin] exclusions: [**/com/module/package/**, **/com/module/package2/MyClass*].

2. I also tried by putting in maven configuration,

<configuration>
<reset>${Reset}</reset>
<address>${testHost}</address>
<excludes>
<!-- exclude generated code from coverage report -->
<exclude>**/com/module/package/**</exclude>
<exclude>**/com/module/package2/MyClass*</exclude>
</excludes>
</configuration>

This also did not work and also did not show the console log also: It was
[JaCoCo plugin] exclusions: []

3. Putting both together also did not work.

How to achieve this exclusion?

Jenkins v: 2.69
Jacoco: 1.0.19

With Jacoco 2.2.1, the coverage was all 0 thats why I think the infra team here downgraded to eariler version.

Regards
Raj

Evgeny Mandrikov

unread,
Nov 23, 2017, 5:03:33 PM11/23/17
to JaCoCo and EclEmma Users
Hi,


On Thursday, November 23, 2017 at 11:19:51 AM UTC+1, Rajdeep Biswas wrote:
Hi,

I am trying to exclude some packages and classes from jacoco coverage report, yet I see them.
I was trying to exclude **/com/module/package2/MyClass* which is a class and **/com/module/package/** which is a package.

1. I put them comma separated in Jenkins plugin for Jacoco in Exclusions box, yet I am seeing them in coverage.
In console, I am seeing though: [JaCoCo plugin] exclusions: [**/com/module/package/**, **/com/module/package2/MyClass*].


Plugin that integrates JaCoCo into Jenkins is not developed by JaCoCo Team, so you'd better seek help from developers of it ( https://github.com/jenkinsci/jacoco-plugin ) - they by definition should know more about this integration.

2. I also tried by putting in maven configuration,

           <configuration>
              <reset>${Reset}</reset>
              <address>${testHost}</address>
              <excludes>
                <!-- exclude generated code from coverage report -->
                <exclude>**/com/module/package/**</exclude>
                <exclude>**/com/module/package2/MyClass*</exclude>
              </excludes>
            </configuration>

This also did not work and also did not show the console log also: It was


[JaCoCo plugin] exclusions: []

3. Putting both together also did not work.


AFAIK specification of exclusions in configuration of jacoco-maven-plugin affects only report generated by jacoco-maven-plugin ( http://www.jacoco.org/jacoco/trunk/doc/report-mojo.html ) and not taken into account by Jenkins plugin.
 

How to achieve this exclusion?


Exclusions are perfectly working and well tested in integrations provided by us (JaCoCo Team) - http://www.jacoco.org/jacoco/trunk/doc/integrations.html , e.g. in jacoco-maven-plugin, so as an option you can use report generated by it.
In case if you wanna use other integration and it doesn't work, such as Jenkins Plugin, then please seek help from developers of this integration.

Thank you for your understanding.

Rajdeep Biswas

unread,
Nov 28, 2017, 6:04:41 AM11/28/17
to JaCoCo and EclEmma Users
Thanks Evgeny, was a good insight.

I tried without jenkins plugin also. But I still see the package 

<plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.4.201502262128</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>dump</goal>
            </goals>
            <configuration>
              <reset>${Reset}</reset>
              <address>${testHost}</address>
                <excludes>
                  <!-- exclude generated code from coverage report -->
                  <exclude>**/pkg1/subpkg1/**</exclude>
                  <exclude>**/pkg2/subpkg1/MyClass*.*</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>

Moreover in the HTML report generated by above, clicking columns is not sorting, for example, by package name.

Thanks
Ra

Evgeny Mandrikov

unread,
Nov 28, 2017, 6:34:05 AM11/28/17
to JaCoCo and EclEmma Users
As of today if you want exclusions to affect report generation, then you must specify them for the report generation, i.e. "report" goal.
 
Moreover in the HTML report generated by above, clicking columns is not sorting, for example, by package name.

Sorting by package name is working as you can see on example of our own report - http://www.jacoco.org/jacoco/trunk/coverage/org.jacoco.report/index.html#dn-a

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages