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.
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.
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.
gitHubUrl, optional
- GitHub repository URL to be used. If present commit messages containing GitHub pull request references are extended with relevant details.
scmUrl, optional
- Git repository URL to be used. If present commit messages are extended with relevant details.
ignoreOlderThen, optional
- Ignore commits older than date (format: YYYY-MM-dd HH:mm:ss)
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>
The git-changelog-maven-plugin contains default template for change log generation but you can define any customized template you want.
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
The git-changelog-maven-plugin is free and open-source software provided under The Apache License, Version 2.0.