HandOfGod94 / jacoco-cov-badge-maven-plugin

Generate High Quality SVG, PNG and JPG Coverage badges locally from jacoco report as part of build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jacoco Coverage Badge Maven Plugin

build Coverage Status Gitter Codacy Badge Maven Central

Checkout Wiki for more info: https://github.com/HandOfGod94/jacoco-cov-badge-maven-plugin/wiki

Contents

Features

  • 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

    veryhigh high medium low

  • Configurable badge keys

    custom1 custom2

  • Generate badges for various categories from jacoco report

    instruction branch complexity

Introduction

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 which shields.io also uses for generating badges.

Quickstart

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>

Build Steps

# To build jar file for plugin
./mvnw clean package

# To install it in local repo
./mvnw clean install

Use mvnw.cmd for windows system.

Usage

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.

About

Generate High Quality SVG, PNG and JPG Coverage badges locally from jacoco report as part of build

License:The Unlicense


Languages

Language:Java 97.3%Language:FreeMarker 2.7%