sbt-git-stamp — An SBT plugin that will stamp the MANIFEST.MF file in the output artifact with some basic git information.

What it does

This plugin will include some basic infomration about the state of the repository that the artifcat was built from, at the time it was built. This information includes:

  • Head revision
  • Branch name
  • Whether or not there were uncommitted changes
  • Build date

This information is included in the MANIFEST.MF file in the jar produced by the package (or assembly) tasks. This can help you track down where a build came from.

How to use it

Add the following to your project/plugins.sbt:

addSbtPlugin("com.atlassian.labs" % "sbt-git-stamp" % "0.1.2")

Add the following near the top of your build.sbt file (if you are using a full build config, I'm sure you can figure it out):

import com.atlassian.labs.gitstamp.GitStampPlugin._

Then, add this lower down:

Seq( gitStampSettings: _* )

Then, just build as normal. This plugin won't add any tasks, or otherwise change the way you interact with SBT.

Your artifacts will just come out with a MANIFEST.MF file that looks something like this:

Manifest-Version: 1.0
Implementation-Vendor: My-Company
Implementation-Title: My Project
Implementation-Version: 0.1
Implementation-Vendor-Id: My-Company
Specification-Vendor: My-Company
Git-Repo-Is-Clean: false
Git-Branch: gitstamp
Specification-Title: My Company
Git-Build-Date: 2013-04-26T17:22:58.538-07:00
Specification-Version: 0.1
Git-Head-Rev: b0d5a67d59dc7c0133aecce2e2ceb18fc8d23597

The entries starting with Git- were added by this plugin.


  • Patrick Kaeding
  • @pkaeding