I've got a pom.xml that looks roughly like this:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<configuration>
<includes>
<include>my/package/path/**/*</include>
</includes>
</configuration>
<!-- more stuff -->
</plugin>
When I run my unit tests then call mvn jacoco:report
locally on my laptop, everything is fine, and only the stuff in my.package.path
is included. My coverage is 86%. However, when I let Jenkins run the unit tests, using the same commands, then call jacoco(execPattern:'target/jacoco.exec')
in my Jenkinsfile, I end up with all code included in the report attached to the build, so my coverage ends up being 2% because I didn't write tests for a bunch of 3rd party libraries.
How do I fix this?