Skip to content
sarhanm edited this page Dec 16, 2020 · 8 revisions

Gradle Versioner Plugin

Build Status

Coverage Status

Gradle Versioner plugin allows you to create semantic based project versions like: 2.1.6.master.d9741b1

The values in the version string are derived from the state of the git repository with a schema of {major}.{minor}.{commits}.{branch}.{commit-hash} and is fully explained on the com.sarhanm.versioner page.

Having derived project versions allows you to:

  1. No longer worry about what the project version should be as you switch branches.
  2. Project version is set based on your branch name so this
    1. Alleviates issues of updating the version before you push.
    2. You know where a version of a library came from
  3. The commit hash is part of the version string so hot fixing is based on the correct commit hash, not from a branch you think is probably the right place to fork from.

The Plugins

There are two plugins that can be applied to your project.

Compatibility

Gradle Version Compatible Versioner Version
< 2.2.1 1.0.58.master.5666bb7
2.2.1 - 2.3 2.0+
>= 2.4 2.1+
>=5.0 4.0+

How to Install

https://plugins.gradle.org/plugin/com.sarhanm.versioner

https://plugins.gradle.org/plugin/com.sarhanm.version-resolver