Your XML code is a bit wrong, you need to add class exceptions to the parent exception exception field, so your above configuration should look like this: Jacoco docs
<configuration> <excludes> <exclude>**/*Config.*</exclude> <exclude>**/*Dev.*</exclude> </excludes> </configuration>
The values โโof exclude fields must be classes (not package names) of compiled classes relative to the target directory / classes / using standard wildcard syntax
* Match zero or more characters ** Match zero or more directories ? Match a single character
You can also exclude a package and all its child / subpackages as follows:
<exclude>some/package*</exclude>
This excludes every class in some.package , as well as all children. For example, some.package.child also not be included in reports.
I tested and reported the results of the report on the reduced number of classes using the above.
If you then click this report on Sonar, you will need to tell Sonar to exclude these classes from the display, which can be done in the Sonar settings.
Settings> General Settings> Exceptions> Code Coverage
Sonar Docs explains it a bit more
Running your command above
mvn clean verify
Will show that classes have been excluded
With no exceptions
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:report (post-test) @ ** --- [INFO] Analyzed bundle '**' with 37 classes
With exceptions
[INFO] --- jacoco-maven-plugin:0.7.4.201502262128:report (post-test) @ ** --- [INFO] Analyzed bundle '**' with 34 classes
Hope this helps
Andrew Kew Mar 06 '15 at 10:33 2015-03-06 10:33
source share