Checkout Wiki for more info: https://github.com/HandOfGod94/jacoco-cov-badge-maven-plugin/wiki
-
Automatically reads
jacoco.csv
reports and generates badge from it locally -
Can be integrated as part of the build process
-
Auto color badges based on the coverage percentage from jacoco reports
-
Configurable badge keys
-
Generate badges for various categories from
jacoco
report
jacoco-cov-badge-maven-plugin
is a maven plugin which can generate svg
,
png
or jpg
badges locally by calculating code coverage from jacoco
report.
Jacoco is code coverage utility which generates nice report for Java Based projects and is generally integrated as maven build plugin.
There are several online utilities like coveralls
, shields.io
etc. which
provides badges as a service.
It is highly inspired from
gh-badges
whichshields.io
also uses for generating badges.
The plugin needs jacoco.csv
report, for it to function correctly.
So you can bind it to any phase after the jacoco.csv
reports gets generated.
Although these are configurable, but some assumptions made by the plugin:
Default jacoco report location: ${project.reporting.outputDirectory}/jacoco/jacoco.csv
Default Output location:${project.build.directory}/coverage.svg
<plugin>
<groupId>io.github.handofgod94</groupId>
<artifactId>jacoco-cov-badge-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>generate-badge</id>
<!-- Note: Make sure in this phase jacoco csv report available -->
<phase>post-site</phase>
<configuration>
<!-- Optional. Check wiki for more info on config parameters -->
</configuration>
<goals>
<goal>badge</goal>
</goals>
</execution>
</executions>
</plugin>
# To build jar file for plugin
./mvnw clean package
# To install it in local repo
./mvnw clean install
Use mvnw.cmd
for windows system.
mvn io.github.handofgod94:jacoco-cov-badge-maven-plugin:1.1.0:badge # if you just want to execute goal
See quickstart example, if you want to use it inside pom.xml
Checkout project wiki for more information.