{"id":16689571,"url":"https://github.com/sigpwned/jacoco-badge-maven-plugin","last_synced_at":"2025-04-10T00:44:35.555Z","repository":{"id":30415584,"uuid":"120968130","full_name":"sigpwned/jacoco-badge-maven-plugin","owner":"sigpwned","description":"A simple maven plugin to generate JaCoCo build badges","archived":false,"fork":false,"pushed_at":"2023-11-12T18:23:50.000Z","size":51,"stargazers_count":4,"open_issues_count":1,"forks_count":28,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T00:44:30.243Z","etag":null,"topics":["build-tool","jacoco","java","maven","maven-plugin","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sigpwned.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-09T23:50:31.000Z","updated_at":"2023-01-20T14:28:19.000Z","dependencies_parsed_at":"2025-02-16T05:32:45.360Z","dependency_job_id":"b32e1822-fc06-42a8-bd7a-472bc6db5b4e","html_url":"https://github.com/sigpwned/jacoco-badge-maven-plugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fjacoco-badge-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fjacoco-badge-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fjacoco-badge-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sigpwned%2Fjacoco-badge-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sigpwned","download_url":"https://codeload.github.com/sigpwned/jacoco-badge-maven-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137997,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","jacoco","java","maven","maven-plugin","testing"],"created_at":"2024-10-12T15:48:38.195Z","updated_at":"2025-04-10T00:44:35.531Z","avatar_url":"https://github.com/sigpwned.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jacoco-badge-maven-plugin ![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYW50WHpPZStGUnVwT0VIWUpkUkhQZGVNWllGdWZuT3cvb3lVRk1ic0p6d0ZUdCt6ZWlyaDRub1E0b2lNNXlUdEQ2YlpBNEhXNTRsaDRBU3p2VnFXTENBPSIsIml2UGFyYW1ldGVyU3BlYyI6IkdjS0JTcFErUURac3VTbisiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D\u0026branch=master) ![Test Coverage](target/jacoco.svg)\n\nA simple maven plugin to generate JaCoCo build badges\n\n## Configuration\n\nBefore we can generate a JaCoCo test coverage badge, we need to run\nJaCoCo test coverage!\n\nJaCoCo measures test coverage of surefire unit tests and failsafe\nintegration tests. Both cases require that JaCoCo be configured to\nintegrate directly with the plugin in question.\n\n### Configuring JaCoCo for Unit Tests\n\nHere is a simple setup for surefire and JaCoCo that generates a\nformatted HTML JaCoCo test coverage report.\n\n    \u003c!-- Set up surefire to run just unit tests and take\n    \u003cplugin\u003e\n      \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n      \u003cartifactId\u003emaven-surefire-plugin\u003c/artifactId\u003e\n      \u003cversion\u003e2.15\u003c/version\u003e\n      \u003cconfiguration\u003e\n        \u003cargLine\u003e${surefireArgLine}\u003c/argLine\u003e\n        \u003cskipTests\u003e${skip.unit.tests}\u003c/skipTests\u003e\n        \u003cexcludes\u003e\n          \u003c!-- Standard approach to excluding integration tests --\u003e\n          \u003cexclude\u003e**/IT*.java\u003c/exclude\u003e\n        \u003c/excludes\u003e\n      \u003c/configuration\u003e\n    \u003c/plugin\u003e\n\n    \u003cplugin\u003e\n      \u003cgroupId\u003eorg.jacoco\u003c/groupId\u003e\n      \u003cartifactId\u003ejacoco-maven-plugin\u003c/artifactId\u003e\n      \u003cversion\u003e0.8.0\u003c/version\u003e\n      \u003cconfiguration\u003e\n        \u003cexcludes\u003e\n          \u003c!-- Any exclusions you require, *.class --\u003e\n        \u003c/excludes\u003e\n      \u003c/configuration\u003e\n      \u003cexecutions\u003e\n        \u003c!-- Ask JaCoCo to generate a test report from surefire tests --\u003e\n        \u003cexecution\u003e\n          \u003cid\u003eprepare-code-coverage\u003c/id\u003e\n          \u003cgoals\u003e\n            \u003cgoal\u003eprepare-agent\u003c/goal\u003e\n          \u003c/goals\u003e\n          \u003cconfiguration\u003e\n            \u003cpropertyName\u003esurefireArgLine\u003c/propertyName\u003e\n          \u003c/configuration\u003e\n        \u003c/execution\u003e\n\n        \u003c!-- Ask JaCoCo to format test report into browsable HTML --\u003e\n        \u003c!-- Multi-module builds should include report-aggregate and use the --\u003e\n        \u003c!-- default outputDirectory. --\u003e\n        \u003c!-- Single-module builds should exclude report-aggregate and use --\u003e\n        \u003c!-- the given outputDirectory. --\u003e\n        \u003cexecution\u003e\n          \u003cid\u003ereport-code-coverage\u003c/id\u003e\n          \u003cgoals\u003e\n            \u003cgoal\u003ereport\u003c/goal\u003e\n            \u003c!-- \u003cgoal\u003ereport-aggregate\u003c/goal\u003e --\u003e\n          \u003c/goals\u003e\n          \u003cconfiguration\u003e\n            \u003c!-- Multi-module builds should \n            \u003coutputDirectory\u003e${project.reporting.outputDirectory}/jacoco-aggregate\u003c/outputDirectory\u003e\n          \u003c/configuration\u003e\n        \u003c/execution\u003e\n\n        \u003c!-- Make sure we have at least 70% coverage --\u003e\n        \u003cexecution\u003e\n          \u003cid\u003everify-test-coverage\u003c/id\u003e\n          \u003cgoals\u003e\n            \u003cgoal\u003echeck\u003c/goal\u003e\n          \u003c/goals\u003e\n          \u003cconfiguration\u003e\n            \u003crules\u003e\n              \u003crule\u003e\n                \u003celement\u003eBUNDLE\u003c/element\u003e\n                \u003cexcludes\u003e\n                  \u003cexclude\u003e*Mojo\u003c/exclude\u003e\n                \u003c/excludes\u003e\n                \u003climits\u003e\n                  \u003climit\u003e\n                    \u003ccounter\u003eINSTRUCTION\u003c/counter\u003e\n                    \u003cvalue\u003eCOVEREDRATIO\u003c/value\u003e\n                    \u003cminimum\u003e70%\u003c/minimum\u003e\n                  \u003c/limit\u003e\n                \u003c/limits\u003e\n              \u003c/rule\u003e\n            \u003c/rules\u003e\n            \u003coutputDirectory\u003e${project.reporting.outputDirectory}/jacoco-aggregate\u003c/outputDirectory\u003e\n          \u003c/configuration\u003e\n        \u003c/execution\u003e\n      \u003c/executions\u003e\n    \u003c/plugin\u003e\n\nWith this configuration, running `mvn test` should generate a friendly\nHTML report of test coverage at `target/site/jacoco-aggregate/index.html`.\n\n### Configuring Badge Generation\n\nOnce JaCoCo has been configured to generate a formatted report, it's\ntime to generate a badge from that report. Here is an example\nconfiguration of this plugin to generate a badge based on unit tests:\n\n    \u003cplugin\u003e\n      \u003cgroupId\u003ecom.sigpwned\u003c/groupId\u003e\n      \u003cartifactId\u003ejacoco-badge-maven-plugin\u003c/artifactId\u003e\n      \u003cversion\u003e0.1.3\u003c/version\u003e\n      \u003cexecutions\u003e\n        \u003cexecution\u003e\n          \u003cid\u003egenerate-jacoco-badge\u003c/id\u003e\n          \u003cphase\u003everify\u003c/phase\u003e\n          \u003cgoals\u003e\n            \u003cgoal\u003ebadge\u003c/goal\u003e \u003c!-- Generate a badge from a unified JaCoCo report --\u003e\n          \u003c/goals\u003e\n          \u003cconfiguration\u003e\n            \u003c!-- What coverage level is considered passing? Optional, default 70. --\u003e\n            \u003cpassing\u003e70\u003c/passing\u003e\n\n            \u003c!-- Legal values: instruction, branch, line, method. Optional, default instruction. --\u003e\n            \u003cmetric\u003einstruction\u003c/metric\u003e\n          \u003c/configuration\u003e\n       \u003c/execution\u003e\n      \u003c/executions\u003e\n    \u003c/plugin\u003e\n\n## Including the Badge in your README\n\nThere are a couple of good ways to include the badge file into your\nREADME:\n\n* GitHub Only -- Generate the badge file into a resource directory,\n  and then embed a reference to the badge into your README. This has\n  the benefit of being very simple, but won't allow for the testing of\n  pull requests, etc. For an example, look at this README.\n\n* CodeBuild -- Save the generated badge file as an artifact; configure\n  S3 to send an event every time a badge is uploaded; use a lambda\n  function to copy the latest badge to a known, fixed location; embed\n  a link to that fixed location.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigpwned%2Fjacoco-badge-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigpwned%2Fjacoco-badge-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigpwned%2Fjacoco-badge-maven-plugin/lists"}