jakubplichta / git-changelog-maven-plugin

Apache License 2.0
8 stars 10 forks source link

git-changelog-maven-plugin

Build Status codecov Maven Central

Introduction

The git-changelog-maven-plugin is Maven plugin for generating change log from GIT repository using Mustache templates.

This plugin is currently designed to work with mainline repositories with one main (master) branch.

Usage

The git-changelog-maven-plugin is available in Maven Central Repository, to use it from Maven add to pom.xml:

<plugin>
    <groupId>info.plichta.maven.plugins</groupId>
    <artifactId>git-changelog-maven-plugin</artifactId>
    <version>0.6.0</version>
</plugin>

See releases page for information about versions and notable changes.

Configuration parameters

Following configuration parameters are supported by the git-changelog-maven-plugin.

repoRoot, default: ${project.basedir}

outputFile, default: ${project.basedir}/CHANGELOG.md

reportTitle, default: Change Log

templateFile, default: ${project.basedir}/changelog.mustache

includeCommits, default: .*

excludeCommits, default: ^\\[maven-release-plugin\\].*

nextRelease, default: ${project.version}

deduplicateChildCommits, default: true

toRef, default: HEAD

jiraServer, optional

gitHubUrl, optional

scmUrl, optional

ignoreOlderThen, optional

Automatic change log generation during Maven release

You can configure Maven release plugin to update change log with each release.

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <preparationGoals>clean git-changelog:git-changelog scm:checkin -DpushChanges=false -Dincludes=CHANGELOG.md -Dmessage="[maven-release-plugin] Update CHANGELOG.md" verify</preparationGoals>
        <completionGoals>git-changelog:git-changelog scm:checkin -DpushChanges=false -Dincludes=CHANGELOG.md -Dmessage="[maven-release-plugin] Update CHANGELOG.md"</completionGoals>
    </configuration>
</plugin>

In the case you don't like two commits for each release you can use simplified configuration which generates changelog only for release prepare goal:

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <preparationGoals>clean git-changelog:git-changelog scm:checkin -DpushChanges=false -Dincludes=CHANGELOG.md -Dmessage="[maven-release-plugin] Update CHANGELOG.md" verify</preparationGoals>
    </configuration>
</plugin>

Mustache templates

The git-changelog-maven-plugin contains default template for change log generation but you can define any customized template you want.

Data structure provided to template

The git-changelog-maven-plugin provides following data structures to Mustache templates:

- reportTitle
* tags
    - name
    * commits
        - title
        - shortHash
        - commitLink
        * children
            - title
            - shortHash
            - commitLink
            - commitTime
        - extensions
            - jira
                * title
                    - token
                    - link
                        - id
                        - link
            - pullRequest
                - id
                - title
                - link

License and conditions

The git-changelog-maven-plugin is free and open-source software provided under The Apache License, Version 2.0.