问题
I have attached jacocoagent with my Tomcat server. I am able to get data in jacoco.exec
and HTML report but I want to exclude some folders from my coverage report. After adding following command, now I can see excluded folders name in my coverage report with 0% coverage. How can I exclude the following folders from the report.
Are these excluded folders still contributing in total coverage percentage which is 15% at the moment?
I have added following command in my Catilina.bat
file:
set JAVA_OPTS=%JAVA_OPTS% -javaagent:"C:/git/project/jacoco/lib/jacocoagent.jar=destfile=C:/git/project/jacoco/dump/jacoco.exec,dumponexit=true,output=file,append=true,excludes=oracle.* :vm.*"
Versions:
Tomcat Server : 7
Operating system : Windows
Jacoco : 0.7.6.201602180812
回答1:
Usage of JaCoCo involves two steps:
- gathering of coverage information
- generation of report
Both can have exclusions. As of today exclusions specified in configuration of agent affect only first step and won't cause automatic exclusion in second step. Why? Because otherwise code that is never executed won't appear in reports. And as stated in JaCoCo agent documentation about option "excludes":
Except for performance optimization or technical corner cases this option is normally not required.
So to really exclude classes from report you should configure step of report generation.
来源:https://stackoverflow.com/questions/40354640/jacoco-coverage-report-is-displaying-excluded-folders-with-0-coverage