An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Git Changelog Maven Plugin

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/se.bjurr.gitchangelog/git-changelog-maven-plugin/badge.svg)](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






```