Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Info

  • run
mvn clean test

it will produce binary file target/jacoco.exec and a regular plain HTML report rendered by jacoco itself (there is a number of alternative processors)

Example

Note, it will be using an javaagent

[INFO] argLine set to -javaagent:C:\\Users\\Serguei\\.m2\\repository\\org\\jacoc
o\\org.jacoco.agent\\0.8.6\\org.jacoco.agent-0.8.6-runtime.jar=destfile=C:\\deve
loper\\sergueik\\selenium_java\\jacoco_examples\\java\\target\\jacoco.exec
  • the code coverage report will be available in
target/site/jacoco/example/Example.html
bash <(curl -s https://codecov.io/bash)

is failing with missing argument:

HTTP 400
Please provide the repository token to upload reports via
`-t :repository-token`

Note

running the goal

mvn jacoco:check

will fail with

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.6:check (defau
lt-cli) on project example_java: The parameters 'rules' for goal org.jacoco:jaco
co-maven-plugin:0.8.6:check are missing or invalid -> [Help 1]
[ERROR]

but jacoco:check goal is bound to verify maven goal and one can run the latter. The downside is that verify is default target and to prevent it from failing the other goals, one will end up setting very low and override via maven parameter:

mvn -Dminimum.coverage=0.85 clean verify

Note: reading properties from envionment in the profile section

    <profile>
      <id>verify</id>
      <properties>
        <minimum.coverage>${env:COVERAGE}</minimum.coverage>
      </properties>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
    </profile>
set COVERAGE=0.85
mvn -P verify clean verify

by vanilla maven is currently not working:

Unable to parse configuration of mojo org.jacoco:jacoco-maven-plugin:0.8.6:check for parameter minimum: Cannot create instance of class java.math.BigDecimal: java.math.BigDecimal.<init>()

therefore one is forced to hardcode the desired coverage level in pom.xml which makes the profile somewhat useless

See Also