How can I exclude certain methods from Jacoco's analysis in Maven configuration?

34 Views Asked by At

I read (some of) Jacoco's documentation and googled, but haven't found an answer to this question

How do I exclude certain methods from Jacoco's reports in Maven configuration?

(please note the emphasis and don't suggest putting @Generated on my hand-written methods which is semantically nonsensical and an ugly kludge, in my opinion)

It's straightforward to exclude certain directories or classes

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.11</version>
                <!-- executions -->
                <configuration>
                    <excludes>
                        <exclude>**/*Exception.*</exclude>
                        <exclude>**/MyApplication.*</exclude>
                    </excludes>
                </configuration>

but it seems a bit more tricky with methods. One thing's for sure, this doesn't work

                        <exclude>**/*.equals</exclude>
                        <exclude>**/*.get*</exclude>

Is there a way to statically exclude certain method patterns from coverage reports to begin with?

0

There are 0 best solutions below