简体   繁体   中英

How can I exclude specified methods and some code of lines in a method from jacoco code coverage?

Require - 排除某些方法并排除方法中的某些行代码

As mentioned in the comment, use the exclude/include as part of your configuration.

Here is an example .

Below is an example in which, 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM