MavenAutoChangelog is a simple maven plugin which generates changelog entries from git commit messages.
It can be configured to add only such messages which meet some format;
It has 2 goals:
generate-changelog
, which will generate the initial changelog fileupdate-changelog
, which will add commits happened between the last tag list in the existing changelog file and thetopGitLogTag
Maven plugin properties:
- pathToChangelog - Path to changelog file. Default is CHANGELOG.md
- topGitLogTag - Git tag up to which the changelog is generated. Default is
HEAD
- tagInfoLinePattern - Pattern, which is used to find the lines with tag information in existing changelog. Should have
tagTitle
andtagDate
pattern groups. Default is"## \\[(?<tagTitle>[\\d.]+)] - (?<tagDate>[\\d]{4}-[\\d]{2}-[\\d]{2})"
- tagInfoLineFormat - Format string for a tag line. Somewhat an opposite to tagInfoLinePattern. Should contain
{{tagTitleFormat}}
and{{tagDateFormat}}
, which will be replaced by the values of the corresponding variables. Default is"## [{{tagTitleFormat}}] - {{tagDateFormat}}"
- tagTitlePattern - Pattern, which tags must satisfy. Default is
(.*)
- tagTitleFormat - Somewhat opposite to tagTitlePattern. How to format tag, relatively to what is printed to changelog. Default is
%s
. - tagDateFormat - How to format tag date, when printed to the changelog file. Used in the tagInfoLineFormat variable. Default is
yyyy-MM-dd
. - applicableCommitPattern - Regexp pattern which is used to filter unwanted commits, i.e. only commits which match this regexp will be included into changelog
- commitLineFormat - Additional java
String.format(commitMessage, commitFormat)
which can be used to customize changelog entry. Default is%s
- unreleasedLinePattern - Regexp pattern which should be used to match line with 'Unreleased' token
- mergeRequestReplacePattern - Regex pattern which is used to add merge request numbers to the messages. It must match the group which will be referenced in
mergeRequestReplacement
. For example(])
to add merge requests before first]
like[ABC-123] Text ==> [ABC-123 321!] Text
. - mergeRequestReplacement - Replacement string which will be used with
mergeRequestReplacePattern
. Must contain tokenMR#
, which will be replaced by merge request number. Default is " MR#$1"
For example you have a CHANGELOG.md looking like
# Change Log
## [Unreleased]
## [22.143.4] - 2022-11-11
- FIX(ALL): fix NPE
## [22.143.3] - 2022-11-09
- CONF(ALL): increase ram
Your configuration may look like:
<configuration>
<tagTitlePattern>release/(.*)</tagTitlePattern>
<tagTitleFormat>release/%s</tagTitleFormat>
<tagInfoLinePattern>## \[(?<tagTitle>[\d.]+)] - (?<tagDate>[\d]{4}-[\d]{2}-[\d]{2})</tagInfoLinePattern>
<tagInfoLineFormat>## [{{tagTitleFormat}}] - {{tagDateFormat}}</tagInfoLineFormat>
<applicableCommitPattern>[ ]*(FIX|PFIX|FEAT|DOC|TECH|PERF|QA|CONF)[A-Z ,\(\)]*:.*</applicableCommitPattern>
<commitLineFormat>- %s</commitLineFormat>
<unreleasedLinePattern>## \[Unreleased.*].*</unreleasedLinePattern>
</configuration>