Skip to content
Multi-language coverage reporter for Codacy
Scala Shell
Branch: master
Clone or download
Latest commit a3f019a Sep 30, 2019

Codacy Coverage Reporter

Codacy Badge Build Status Maven Central

Multi-language coverage reporter for Codacy


  • Java JRE 8 and higher


Codacy assumes that coverage is previously configured for your project. The supported coverage formats are JaCoCo and Cobertura.

  1. Setup the project API token. You can find the token in Project -> Settings -> Integrations -> Project API.

Then set it in your terminal, replacing %Project_Token% with your own token:

export CODACY_PROJECT_TOKEN=%Project_Token%

Linux amd64

Download the latest binary and use it to post the coverage to Codacy


LATEST_VERSION="$(curl -Ls | jq -r .name)"
curl -Ls -o codacy-coverage-reporter "${LATEST_VERSION}/codacy-coverage-reporter-linux"
chmod +x codacy-coverage-reporter
./codacy-coverage-reporter report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml


curl -Ls -o codacy-coverage-reporter "$(curl -Ls | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')"
chmod +x codacy-coverage-reporter
./codacy-coverage-reporter report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml


  • Linux x86, MacOS, Windows, ...

Download the latest jar and use it to post the coverage to Codacy


LATEST_VERSION="$(curl -Ls | jq -r .name)"
curl -Ls -o codacy-coverage-reporter-assembly.jar "${LATEST_VERSION}/codacy-coverage-reporter-assembly.jar"
java -jar codacy-coverage-reporter-assembly.jar report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml


curl -Ls -o codacy-coverage-reporter-assembly.jar $(curl -Ls | jq -r '.assets | map({content_type, browser_download_url} | select(.content_type | contains("java-archive"))) | .[0].browser_download_url')
java -jar codacy-coverage-reporter-assembly.jar report -l Java -r jacoco.xml

CommitUUID Detection

Codacy automatically detects the CommitUUID from several sources:

Environment Variables


Git directory

  • If it finds a git directory it will get current commit.

Force CommitUUID

  • You may want to enforce a specific commitUUID with:
codacy-coverage-reporter report -l Java --commit-uuid "mycommituuid" -r coverage.xml

Upload coverage

Next, simply run the Codacy reporter. It will find the current commit and send all details to your project dashboard:

codacy-coverage-reporter report -l Java -r coverage.xml

Note: You should keep your API token well protected, as it grants owner permissions to your projects.

Multiple coverage reports for the same language

In order to send multiple reports for the same language, you need to upload each report separately with the flag --partial and then notify Codacy, after all reports were sent, with the final command.


  1. codacy-coverage-reporter report -l Java -r report1.xml --partial
  2. codacy-coverage-reporter report -l Java -r report2.xml --partial
  3. codacy-coverage-reporter final

If you are sending reports with the partial flag for a certain language you should use it in all reports for that language to ensure the correct calculation of the coverage.

It might also be possible to merge the reports before uploading them to Codacy, since most coverage tools support merge/aggregation, example: .

Other Languages

If your language is not in the list of supported languages, you can still send coverage to Codacy. Just provide the correct --language name and then add --force-language to make sure it is sent.


To send coverage in the enterprise version you should:

export CODACY_API_BASE_URL=<Codacy_instance_URL>:16006

Or use the option --codacy-api-base-url <Codacy_instance_URL>:16006.

Other commands

For a complete list of commands and options run:

java -jar codacy-coverage-reporter-<version>-assembly.jar --help

Java 6

Due to a limitation in Java 6, the plugin is unable to establish a connection to You can run this script after the execution to upload the generated report to Codacy.

Build from source

If you are having any issues with your installation, you can also build the coverage reporter from source.

  1. Clone our repository

  2. Run the command sbt assembly. This will produce a .jar that you can run in the codacy-coverage-reporter/target/codacy-coverage-reporter-<version>-assembly.jar

  3. In the project you want to send the coverage, use the jar. Example:

<path>/java-project$ java -jar ../codacy-coverage-reporter/target/codacy-coverage-reporter-<version>-assembly.jar report -l Java -r jacoco.xml

Gradle task

A big shout-out to tompahoward, you can create a gradle task as suggested in

task uploadCoverageToCodacy(type: JavaExec, dependsOn : jacocoTestReport) {
   main = "com.codacy.CodacyCoverageReporter"
   classpath = configurations.codacy
   args = [

task (codacyDepsize) << {
def size = 0;
configurations.codacy.collect { it.length() / (1024 * 1024) }.each { size += it }
println "Total dependencies size: ${Math.round(size * 100) / 100} Mb"

        .sort { -it.length() }
        .each { println "${} : ${Math.round(it.length() / (1024) * 100) / 100} kb" }

task (codacyLocs) << {
    configurations.codacy.each {
        String jarName = it
        println jarName

Gradle task by Mr_ramych. Made up from solution above.

configurations { codacy }
repositories {
    maven { url "" }
    maven { url "" }
dependencies {
    codacy 'com.github.codacy:codacy-coverage-reporter:-SNAPSHOT'
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
    main = "com.codacy.CodacyCoverageReporter"
    classpath = configurations.codacy
    args = [

Community supported alternatives

Maven plugin

Thanks to the amazing job of halkeye you can now send your coverage to Codacy using a maven plugin!

Just follow the instructions on his repository.

Travis CI

If you want to use codacy with Travis CI and report coverage generated from your tests run in Travis, update your .travis.yml to include the following blocks:

  - sudo apt-get install jq
  - curl -LSs $(curl -LSs | jq -r '.assets | map({content_type, browser_download_url} | select(.content_type | contains("application/java-archive"))) | .[0].browser_download_url') -o codacy-coverage-reporter-assembly.jar

  - java -jar codacy-coverage-reporter-assembly.jar report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml

Make sure you have set CODACY_PROJECT_TOKEN as an environment variable in your travis job!


Failed to upload report: Not Found

Error when running the command, then you'll probably have codacy-coverage-reporter 1.0.3 installed. Make sure you install version 1.0.4, that fixes that error.

Example (issue: #11) :

codacy-coverage-reporter report -l Java -r PATH_TO_COVERAGE/coverage.xml
2015-11-20 04:06:58,887 [info]  com.codacy Parsing coverage data...
2015-11-20 04:06:59,506 [info]  com.codacy Uploading coverage data...

2015-11-20 04:07:00,639 [error] com.codacy Failed to upload report: Not Found

Even after doing all of the above troubleshooting steps in case you still encounter the same error

2015-11-20 04:07:00,639 [error] com.codacy Failed to upload report: Not Found

Please try running the command with a --prefix option with path to your code as shown below , it helps to locate the files for which code coverage is desired

codacy-coverage-reporter report -l Java -r PATH_TO_COVERAGE/coverage.xml --prefix PATH_TO_THE_DIRECTORY


codacy-coverage-reporter report -l Java -r api/target/site/jacoco/jacoco.xml --prefix api/src/main/java/

What is Codacy?

Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.

Among Codacy’s features:

  • Identify new Static Analysis issues
  • Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
  • Auto-comments on Commits and Pull Requests
  • Integrations with Slack, HipChat, Jira, YouTrack
  • Track issues Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

Free for Open Source

Codacy is free for Open Source projects.

You can’t perform that action at this time.