sbt Plugin
The sbt-version plugin integrates Git-based version resolution into sbt builds.
addSbtPlugin("africa.shuwari" % "sbt-version" % "@VERSION@")
Overview
The plugin automatically:
- Resolves the current version from Git state
- Sets
ThisBuild / version - Supports custom rendering via version.Version.Show
By default, version.Version.Show.Standard is used, which outputs the core version and pre-release but excludes build metadata. Use version.Version.Show.Extended to include metadata.
No manual version management required.
Quick Start
The plugin is auto-triggered — just add it to project/plugins.sbt:
addSbtPlugin("africa.shuwari" % "sbt-version" % "@VERSION@")
Check the resolved version:
> show version
[info] 1.2.3-SNAPSHOT
Behaviour
At a Release Tag
git tag -a v1.2.3 -m "Release 1.2.3"
> show version
[info] 1.2.3
During Development
> show version
[info] 1.2.4-SNAPSHOT
With Extended Rendering
To include build metadata (branch, commits, SHA):
// build.sbt
versionShow := Some(Version.Show.Extended)
> show version
[info] 1.2.4-SNAPSHOT+branchmain.commits5.shaabc1234
Platform Support
| sbt Version | Status |
|---|---|
| sbt 2.x | ✅ |
| sbt 1.x | — |
In This Section
- Installation — setup guide
- Settings — configuration reference
- Custom Rendering — version string customisation
In this article