jacoco:check

Full name:

org.jacoco:jacoco-maven-plugin:0.7.1.201405082137:check

Description:

Checks that the code coverage metrics are being met.

Attributes:

Required Parameters

Name Type Since Description
haltOnFailure boolean 0.6.1 Halt the build if any of the checks fail.
Default value is: true.
rules List 0.6.1

Check configuration used to specify rules on element types (BUNDLE, PACKAGE, CLASS, SOURCEFILE or METHOD) with a list of limits. Each limit applies to a certain counter (INSTRUCTION, LINE, BRANCH, COMPLEXITY, METHOD, CLASS) and defines a minimum or maximum for the corresponding value (TOTALCOUNT, COVEREDCOUNT, MISSEDCOUNT, COVEREDRATIO, MISSEDRATIO). If a limit refers to a ratio the range is from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. Note that you must use implementation hints for rule and limit when using Maven 2, with Maven 3 you do not need to specify the attributes.

This example requires an overall instruction coverage of 80% and no class must be missed:


<rules>
  <rule implementation="org.jacoco.maven.RuleConfiguration">
    <element>BUNDLE</element>
    <limits>
      <limit implementation="org.jacoco.report.check.Limit">
        <counter>INSTRUCTION</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.80</minimum>
      </limit>
      <limit implementation="org.jacoco.report.check.Limit">
        <counter>CLASS</counter>
        <value>MISSEDCOUNT</value>
        <maximum>0</maximum>
      </limit>
    </limits>
  </rule>
</rules>

This example requires a line coverage minimum of 50% for every class except test classes:


<rules>
  <rule>
    <element>CLASS</element>
    <excludes>
      <exclude>*Test</exclude>
    </excludes>
    <limits>
      <limit>
        <counter>LINE</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.50</minimum>
      </limit>
    </limits>
  </rule>
</rules>

Optional Parameters

Name Type Since Description
dataFile File 0.6.1 File with execution data.
Default value is: ${project.build.directory}/jacoco.exec.
excludes List 0.6.1 A list of class files to exclude from instrumentation/analysis/reports. May use wildcard characters (* and ?). When not specified nothing will be excluded.
includes List 0.6.1 A list of class files to include in instrumentation/analysis/reports. May use wildcard characters (* and ?). When not specified everything will be included.
skip boolean 0.6.1 Flag used to suppress execution.
Default value is: false.

Parameter Details

dataFile:

File with execution data.

excludes:

A list of class files to exclude from instrumentation/analysis/reports. May use wildcard characters (* and ?). When not specified nothing will be excluded.

haltOnFailure:

Halt the build if any of the checks fail.

includes:

A list of class files to include in instrumentation/analysis/reports. May use wildcard characters (* and ?). When not specified everything will be included.

rules:

Check configuration used to specify rules on element types (BUNDLE, PACKAGE, CLASS, SOURCEFILE or METHOD) with a list of limits. Each limit applies to a certain counter (INSTRUCTION, LINE, BRANCH, COMPLEXITY, METHOD, CLASS) and defines a minimum or maximum for the corresponding value (TOTALCOUNT, COVEREDCOUNT, MISSEDCOUNT, COVEREDRATIO, MISSEDRATIO). If a limit refers to a ratio the range is from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. Note that you must use implementation hints for rule and limit when using Maven 2, with Maven 3 you do not need to specify the attributes.

This example requires an overall instruction coverage of 80% and no class must be missed:


<rules>
  <rule implementation="org.jacoco.maven.RuleConfiguration">
    <element>BUNDLE</element>
    <limits>
      <limit implementation="org.jacoco.report.check.Limit">
        <counter>INSTRUCTION</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.80</minimum>
      </limit>
      <limit implementation="org.jacoco.report.check.Limit">
        <counter>CLASS</counter>
        <value>MISSEDCOUNT</value>
        <maximum>0</maximum>
      </limit>
    </limits>
  </rule>
</rules>

This example requires a line coverage minimum of 50% for every class except test classes:


<rules>
  <rule>
    <element>CLASS</element>
    <excludes>
      <exclude>*Test</exclude>
    </excludes>
    <limits>
      <limit>
        <counter>LINE</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.50</minimum>
      </limit>
    </limits>
  </rule>
</rules>

skip:

Flag used to suppress execution.