Project Introduction: axion-release-plugin
The axion-release-plugin is a useful tool for managing releases and versioning in Gradle projects. Unlike Maven, which provides the maven-release-plugin to handle version releases, Gradle does not come with a similar tool. However, with the axion-release-plugin, developers can effectively manage project versions by integrating versioning with Source Control Management (SCM).
The Philosophy Behind axion-release-plugin
This plugin operates on a simple yet powerful philosophy: the idea that the SCM is the ultimate source of truth for project versions. Instead of hardcoding the version in files like pom.xml or build.gradle, the axion-release-plugin derives the project version from the nearest tag in the SCM. If the current commit is tagged, it implies the project is at a release version. On the other hand, if there have been additional commits since the last tag, the project is considered to be in a SNAPSHOT version. This approach, combined with the principles of Semantic Versioning, simplifies the management of project versions by aligning them directly with SCM tag versions.
System Requirements
To harness the power of the axion-release-plugin, users will need at least JDK11+ and Gradle 7+.
Getting Started with axion-release-plugin
Implementing the plugin is straightforward. Here’s an example to illustrate:
plugins {
id("pl.allegro.tech.build.axion-release") version "1.18.7"
}
version = scmVersion.version
This setup allows users to manage project versions seamlessly. Here is a quick workflow:
- Initially, when no tags exist, running
./gradlew currentVersion
would output a default version like0.1.0-branch-SNAPSHOT
. - Executing
./gradlew release
tags the commit, assigning it versionv0.1.0
. - Subsequent changes and a release will tag another version (
v0.1.1
), reflecting the latest additions.
Availability and License
Comprehensive documentation is available for users at the axion-release read the docs.
The axion-release-plugin is freely available and published under the Apache License 2.0, encouraging wide usage and contributions from the community.
In summary, the axion-release-plugin is designed to streamline the complexities of release and version management in Gradle projects, aligning closely with modern software development practices by leveraging SCM as the central point of version truth.