3

I'm working on code coverage for a Java library. It's a SOAP/REST client. The client has several packages dataTypes.generated. for the generated types for connecting to the server side. For working with the client there is a translation layer to some more common types just in the dataTypes package, that I also want to filter out of coverage. However, I do have some some utility classes in dataTypes.helpers that I want to keep included.

I've tried:

  <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <version>0.7.4.201502262128</version>
      <configuration>
       <dataFile>${project.build.directory}/jacoco.exec</dataFile>
       <destFile>${project.build.directory}/jacoco.exec</destFile>
       <excludes>
         <exclude>**/dataTypes/*.*</exclude>
         <exclude>**/generated/*</exclude>
         <exclude>**/generated/**</exclude> -->
       </excludes>
       <includes>
         <include>**/dataTypes/helpers/*</include>
       </includes>
   </plugin>

however, That didn't remove it from coverage.
In EclEmma I then set:

Includes: *:**/dataTypes/helpers/*
Excludes: **/dataTypes/*:**/generated/*

That didn't work either. It actually seemed to break something in EclEmma and code coverage didn't display at all.

I had it working at one point.

I used Excludes: but that doesn't remove code from coverage, it just forces coverage to 0%, I'd just rather not see it in the report at all. How can I do that?

Raystorm
  • 6,180
  • 4
  • 35
  • 62
  • where did you put those excludes statement? It apply the inclusion/exclusion in the prepare-agent goal defined by the jacoco plugin – drgn Mar 10 '16 at 14:21
  • @drgn I've updated the question with the complete plugin section for the `jacoco-maven-plugin` – Raystorm Mar 10 '16 at 14:25
  • this might be helpful: http://stackoverflow.com/questions/27799419/maven-jacoco-configuration-exclude-classes-packages-from-report-not-working - it does not look so bad. maybe the exclusion patterns dont work like that. often multiple ** are not recognized. maybe "*/**/generated/*" (and removing the second one so no pattern contains two "**")? Try and error it is :/ – wemu Mar 10 '16 at 16:26
  • @Raystorm did you solve the issue since then? – A_Di-Matteo Mar 14 '16 at 21:58
  • @A. Di Matteo I've been unable to get filtering to work from maven. I think it may be unsupported. I have gotten includes/excludes working but it's been unstable. I'd really like to get maven and EclEmma synced but so far I haven't had much luck. – Raystorm Mar 14 '16 at 22:13

0 Answers0