Coverage Services

Examples of uploading to Coveralls and Codecov can be found in the example project: stringbean/sbt-jacoco-example

Coveralls

If you have a public project built with Travis-CI you will just need to enable the Coveralls plugin:

enablePlugins(JacocoCoverallsPlugin)

Then run sbt jacocoCoveralls to upload the results to Coveralls:

[info] Uploading coverage to coveralls.io...
[info] Upload complete

For private projects you will need to set a few more settings:

jacocoCoverallsServiceName := "jenkins"
jacocoCoverallsJobId := sys.env("BUILD_ID")
jacocoCoverallsRepoToken := "<repo token on coveralls.io>"

More settings can found at Coveralls Plugin settings.

Codecov

The Codecov uploader script will upload coverage automatically if the XML formatter is enabled. For example:

jacocoReportSettings := JacocoReportSettings(
  "Jacoco Coverage Report",
  None,
  JacocoThresholds(),
  Seq(JacocoReportFormats.ScalaHTML, JacocoReportFormats.XML), // note XML formatter
  "utf-8")

With this enabled run the Codecov script after JaCoCo:

sbt jacoco
bash <(curl -s https://codecov.io/bash)
The source code for this page can be found here.