Home

Awesome

coveralls-gradle-plugin v2.12.2

Java CI Coverage Status

Send coverage data to coveralls.io.

Usage

Use with cobertura reporter

Add the following lines to build.gradle:

plugins {
    id 'net.saliman.cobertura' version '4.0.0'
    id 'com.github.kt3k.coveralls' version '2.12.2'
}

cobertura.coverageFormats = ['html', 'xml'] // coveralls plugin depends on xml format report

And run coveralls task after cobertura task.

An example .travis.yml looks like following:

language: java

jdk:
- oraclejdk11

after_success:
- ./gradlew cobertura coveralls

For groovy projects, add the following line to build.gradle:

cobertura.coverageSourceDirs = sourceSets.main.groovy.srcDirs

Use with JaCoCo plugin

Add the following lines to build.gradle:

plugins {
    id 'jacoco'
    id 'com.github.kt3k.coveralls' version '2.12.2'
}

jacocoTestReport {
    reports {
        xml.enabled = true // coveralls plugin depends on xml format report
        html.enabled = true
    }
}

An example .travis.yml looks like following:

language: java

jdk:
- oraclejdk11

after_success:
- ./gradlew jacocoTestReport coveralls

Configuration Options

coveralls {
    jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
}

Use with pitest plugin

Add the following lines to build.gradle:

plugins {
    id "info.solidsoft.pitest" version '1.6.0'
    id 'com.github.kt3k.coveralls' version '2.12.2'
}

pitest {
    timestampedReports = false
    outputFormats = ['XML']
}

An example .travis.yml looks like following:

language: java

jdk:
- oraclejdk11

after_success:
- ./gradlew pitest coveralls

Use with Travis-CI Pro & Coveralls Pro

When using Travis-CI Pro, you must provide your Coveralls Pro repo token in the COVERALLS_REPO_TOKEN environment variable in .travis.yml.

env:
  global:
    - COVERALLS_REPO_TOKEN=mySecRetRepoToken

You may also use a secure environment variable to hold COVERALLS_REPO_TOKEN by following the instructions on docs.travis-ci.com.

env:
  global:
    - secure: <encrypted string here>

Use with multi-project build

This plugin only handles one project per build. You need to merge coverage report before coveralls plugin take it.

See example: https://github.com/ben-manes/caffeine/blob/v2.6.2/build.gradle#L133

Configuring coveralls "task"

If you configure coveralls "task" (not the extension object), you need to write as the following:

tasks.coveralls {
  dependsOn 'check'
}

CI Services

The following CI services should automatically work:

If you need to customize something or support a different CI service, you can configure environment variables:

Supported CI names

If you have COVERALLS_REPO_TOKEN set and you're using Travis-CI not Travis-Pro, you need to set CI_NAME=travis-ci.

HTTPS proxy settings

You can set https proxy if needed. Environment variables to configure:

Examples

License

MIT License ( Yoshiya Hinosawa )

Note

See also

Release History