Exclude package but include one class in JaCoCo report

29 Views Asked by At

I have a lot of autogenerated and a few handwritten classes in same package. I want to exclude all of the autogenerated classes without adding each of the exclusions. Is there a way to exclude the package and then just include the few handwritten classes in JaCoCo report?

I tried something like this:

<plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.8</version>
        <configuration>
          <outputDirectory>${project.build.directory}/jacoco-reports</outputDirectory>
          <excludes>
            <!--
              Exclusions for code coverage
              Excluding auto-generated source, main classes, configs and constants.
              For more details, please see https://www.eclemma.org/jacoco/trunk/doc/report-mojo.html#excludes
            -->
            <exclude>com/company/xxx/aaa/model/*</exclude>
          </excludes>
          <includes>
            <include>com/company/xxx/aaa/model/MyClass.class</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
</plugin>

But the report is empty with message: No class files specified.

Is it possible to exclude package and then include a class from this package? If it is possible how can I achive this?

0

There are 0 best solutions below