How can I filter out packages from the JaCoCo Maven scope?

Viewed 1312

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?

0 Answers
Related