/git-changelog-maven-plugin

Maven plugin to automatically generate changelogs from git repo commits

Primary LanguageJavaApache License 2.0Apache-2.0

git-changelog-maven-plugin

Build Status Coverage Status Maven Central

Note

Originally forked from git-changelog-maven-plugin, to accommodate changes necessary to properly generate changelogs in BitBucket environment.

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>com.xfyre.maven.plugins</groupId>
    <artifactId>git-changelog-maven-plugin</artifactId>
    <version>0.4.3</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}

  • path to GIT repository root.

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

  • location of the generated change log file.

reportTitle, default: Change Log

  • string passed as report title to templates.

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

  • location of the template file. If not found default changelog.mustache resource from plugin will be used.

includeCommits, default: .*

  • which commits are to be included.

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

  • which commits are to be skipped.

nextRelease, default: ${project.version}

  • string representing unreleased project version.

deduplicateChildCommits, default: true

  • when set to true child commits containing same message as pull request are not included in resulting change log.

toRef, default: HEAD

  • latest GIT commit to be used.

jiraServer, optional

  • Jira server URL to be used. If present commit messages containing issue references are extended with ticket details.

repositoryUrl, optional

  • GitHub repository URL to be used. If present commit messages containing GitHub pull request references are extended with relevant details.

commitPrefix, optional

  • URL path prefix for commit links. Defaults to /commit/ (which is valid for GitHub), needs to be changed if you are using something else (like BitBucket or Stash).

pullRequestPrefix, optional

  • URL path prefix for pull request links. Defaults to /pull/ (which is valid for GitHub), needs to be changed if you are using something else (like BitBucket or Stash).

ignoreOlderThen, optional

  • Ignore commits older than date (format: YYYY-MM-dd HH:mm:ss)

releaseTagFilter, optional

  • Filter release tags by regex. By default it's assumed to be ^.+$

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>

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.