Discussion:
[java code coverage] Exclusions not working in Jenkins Jacoco FT coverage
r***@gmail.com
2017-11-23 10:19:51 UTC
Permalink
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
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/82226e26-258a-4346-8a4e-8ea432ebd5eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Evgeny Mandrikov
2017-11-23 22:03:33 UTC
Permalink
Hi,
Post by r***@gmail.com
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.
[**/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,
Post by r***@gmail.com
<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: []
Post by r***@gmail.com
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.
Post by r***@gmail.com
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.
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/79dc2600-2387-43ce-b5ca-68fc760dd9f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rajdeep Biswas
2017-11-28 11:04:41 UTC
Permalink
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
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/0773c057-460c-419d-894d-97d375143831%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Evgeny Mandrikov
2017-11-28 11:34:05 UTC
Permalink
Post by Rajdeep Biswas
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>
As of today if you want exclusions to affect report generation, then you
must specify them for the report generation, i.e. "report" goal.
https://github.com/jacoco/jacoco/issues/424
https://github.com/jacoco/jacoco/issues/188
Post by Rajdeep Biswas
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
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/49b7f214-f064-4375-a597-c75f6ce1d672%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...