How would I add an annotation to exclude a method from a jacoco code coverage report?

后端 未结 4 947
庸人自扰
庸人自扰 2020-12-14 16:13

I have some code in Java that I want to exclude from code coverage. How would I do this? I want to be able to add an annotation. Is there a way to configure or extend jacoco

4条回答
  •  情书的邮戳
    2020-12-14 16:25

    The new feature has been added in the 0.8.2 release of JaCoCo which filters out the classes and methods annotated with @Generated. For details please see the documentation below:

    Classes and methods annotated with annotation whose retention policy is runtime or class and whose simple name is Generated are filtered out during generation of report (GitHub #731).

    JaCoCo 0.8.2 Release Notes

提交回复
热议问题