https://github.com/tomasbjerre/git-changelog-maven-plugin
Maven plugin that can generate a changelog, or releasenotes, from git repository
https://github.com/tomasbjerre/git-changelog-maven-plugin
changelog git github jira
Last synced: 6 months ago
JSON representation
Maven plugin that can generate a changelog, or releasenotes, from git repository
- Host: GitHub
- URL: https://github.com/tomasbjerre/git-changelog-maven-plugin
- Owner: tomasbjerre
- License: other
- Created: 2015-11-15T13:18:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-16T15:04:53.000Z (7 months ago)
- Last Synced: 2025-03-29T09:07:58.765Z (6 months ago)
- Topics: changelog, git, github, jira
- Language: Java
- Homepage:
- Size: 692 KB
- Stars: 86
- Watchers: 6
- Forks: 36
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Git Changelog Maven Plugin
[](https://maven-badges.herokuapp.com/maven-central/se.bjurr.gitchangelog/git-changelog-maven-plugin)
This is a Maven plugin for [Git Changelog Lib](https://github.com/tomasbjerre/git-changelog-lib).
| Version | Java Version |
| ------------------------ | ------------ |
| version < 2.0.0 | 8 |
| 2.0.0 <= version < 2.2.0 | 11 |
| 2.2.0 <= version | 17 |## Usage
There is a running example [here](/git-changelog-maven-plugin-example). See also [bjurr-bom](https://github.com/tomasbjerre/bjurr-bom).
Have a look at the [pom.xml](/git-changelog-maven-plugin-example/pom.xml) where you will find some more examples.
Here is and example that will generate a CHANGELOG.md when running `mvn generate-resources`.
```xml
se.bjurr.gitchangelog
git-changelog-maven-plugin
${changelog}
org.openjdk.nashorn
nashorn-core
15.4
GenerateGitChangelog
generate-sources
git-changelog
```If you have a multimodule you may want to put `false` within the `` tag to avoid it being applied to all child projects.
### Template - Simple
```hbs
{{#tags}}
## {{name}}
{{#issues}}
{{#hasIssue}}
{{#hasLink}}
### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
{{/hasLink}}
{{^hasLink}}
### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
{{/hasLink}}
{{/hasIssue}}
{{^hasIssue}}
### {{name}}
{{/hasIssue}}{{#commits}}
**{{{messageTitle}}}**{{#messageBodyItems}}
* {{.}}
{{/messageBodyItems}}[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*
{{/commits}}
{{/issues}}
{{/tags}}
```### Template - Semantic versioning from conventional commits
If you are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/):
```shell
[optional scope]:[optional body]
[optional footer(s)]
```A changelog can be rendered (using [Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers)) like this:
```hbs
# Changelog{{#tags}}
{{#ifReleaseTag .}}
## [{{name}}](https://gitservice/{{name}}) ({{tagDate .}}){{#ifContainsType commits type='feat'}}
### Features{{#commits}}
{{#ifCommitType . type='feat'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
{{/ifCommitType}}
{{/commits}}
{{/ifContainsType}}{{#ifContainsType commits type='fix'}}
### Bug Fixes{{#commits}}
{{#ifCommitType . type='fix'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
{{/ifCommitType}}
{{/commits}}
{{/ifContainsType}}{{/ifReleaseTag}}
{{/tags}}
```### Example - custom helpers
You can add your own helpers and use them in the template. There are also [built in Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers).
```xml
se.bjurr.gitchangelog
git-changelog-maven-plugin
${changelog}
org.openjdk.nashorn
nashorn-core
15.4
GenerateGitChangelog
generate-sources
git-changelog
```More documentation can be found in the [Git Changelog Lib](https://github.com/tomasbjerre/git-changelog-lib).
### Configuration
Have a look at the [pom.xml](/git-changelog-maven-plugin-example/pom.xml) where you will find some more examples.
#### Update version based on conventional commits
The version in `pom.xml` can be automatically updated based on [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
From command line:
```sh
mvn se.bjurr.gitchangelog:git-changelog-maven-plugin:VERSION_HERE:semantic-version
```You can combine it with maven release plugin like this:
```sh
mvn \
se.bjurr.gitchangelog:git-changelog-maven-plugin:VERSION_HERE:semantic-version \
release:prepare release:perform
```Or in `pom.xml`:
```xml
se.bjurr.gitchangelog
git-changelog-maven-plugin
${changelog}
org.openjdk.nashorn
nashorn-core
15.4
GenerateGitChangelog
generate-sources
semantic-version
false
true
^[Bb]reaking
[Ff]eature
[Ff]ix
```