jacoco:check

Full name :

org.jacoco:jacoco-maven-plugin:0.8.13-SNAPSHOT: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 .
User property is : jacoco.haltOnFailure .
<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 it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.

If not specified the following defaults are assumed:

  • rule element: BUNDLE
  • limit counter: INSTRUCTION
  • limit value: COVEREDRATIO

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

                                
                                
<rules>
  <rule>
    <element>BUNDLE</element>
    <limits>
      <limit>
        <counter>INSTRUCTION</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.80</minimum>
      </limit>
      <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>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 analysis. May use wildcard characters (* and ?). When not specified nothing will be excluded.
<includes> List 0.6.1 A list of class files to include into analysis. 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 .
User property is : jacoco.skip .

Parameter Details

<dataFile>
File with execution data.
<excludes>
A list of class files to exclude from analysis. 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 into analysis. 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 it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.

If not specified the following defaults are assumed:

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

                    
                    
<rules>
  <rule>
    <element>BUNDLE</element>
    <limits>
      <limit>
        <counter>INSTRUCTION</counter>
        <value>COVEREDRATIO</value>
        <minimum>0.80</minimum>
      </limit>
      <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>50%</minimum>
      </limit>
    </limits>
  </rule>
</rules>
                    
                
<skip>
Flag used to suppress execution.