junitcode-coveragejacoco-maven-plugin

How to exclude certain package while running the Code Coverage in spring Boot using jacoco


        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>**/package1/subpackage/*</exclude>
                </excludes>
            </configuration>
        </plugin>

I want to ignore all class under certain package. Im running Code coverage option given in the eclipse itself. If anything is wrong comment down


Solution

  • Here is a working example for includes and exclude configuration of jacoco-maven-plugin.

    All classes which has jacocodemo in it is package are included except if they have jacocodemo/strings in them.

    <execution>
        <id>jacoco-report</id>
        <goals>
            <goal>report</goal>
        </goals>
        <configuration>
            <includes>
                <include>**/jacocodemo/**/*</include>
            </includes>
            <excludes>
                <exclude>**/jacocodemo/strings/*</exclude>
            </excludes>
        </configuration>
    </execution>