Speed up version releasing with Gradle

Context and previous status

Symphonica project has multiple projects associated, each of them with their own Git repository and version number. Each project builds, at least, one artifact that we upload to the company Maven repository executing a Jenkins job through a Gradle Plugin. The project version number is in the artifact filename and inside the artifact (MANIFEST.MF file). We have decided to put it inside the artifact for the reasons listed below:

  • to easily get the artifact version number from an artifact file without the standard filename.
  • to give the possibility to expose the version number through any application interface.
  • to comply with OSGi standards.

Few months ago, during a Symphonica team meeting, we were discussing the tasks we do when we have to release a version and the possibility to automate it. We wanted to release a project version in only one click; using Jenkins without doing pre or post Git commits to change the version number or the “change log file”. Therefore, we have created two Gradle plugins for that purpose.

Generating “change log file” from Git commits using Gradle

We use this plugin to generate the “change log file” from commit messages. How? Easy. We use org.ajoberstar.grgit project (https://github.com/ajoberstar/grgit) to interact with local Git repository. The “change log file” is generated and stored within the artifact. The only thing we have to do is to parse commit messages and write them into CHANGELOG.md file.

Nowadays, our commit messages look like as follows:

@issue JiraIssueNumber

Added: Description for the cool new feature that has been added.
Changed: Description of the feature that has been modified.
Deprecated: Description of the feature that is to be removed in the following release.
Fixed: Description of the bug that has been fixed in the current release.
Removed: Description of the feature that is to be removed and is no longer available.

Get project version number from Git using Gradle

This plugin sets a Gradle version variable using the branch or tag name. When dealing with a branch, we add the suffix “SNAPSHOT” to the version name. For that purpose, we use the same project to interact with local Git repository.


No more pre or post commits to perform a version release!

You may also like

Spring Boot

Spring Boot 1 to Spring Boot 2


Modifiability – What is it? And some Java Solutions

How to Build Custom Java Annotations