Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building packages using sbt-git results in "SNAPSHOT-SNAPSHOT" version qualifier

Tags:

git

version

sbt

We're using SBT with sbt-git to derive the version of our build from the Git revision. Specifically, we're using the output from git describe as version number and append the "SNAPSHOT" qualifier when the current revision is not tagged:

val versionRegex = "v([0-9]+.[0-9]+.[0-9]+)-?(.*)?".r

git.useGitDescribe := true
git.baseVersion := "0.0.0"
git.gitTagToVersionNumber := {
  case versionRegex(v, "") => Some(v)
  case versionRegex(v, "SNAPSHOT") => Some(s"$v-SNAPSHOT")
  case versionRegex(v, s) => Some(s"$v-$s-SNAPSHOT")
  case _ => None
}

However, this sometimes results the qualifier being duplicated, i.e. version numbers like "0.0.0-12345678-SNAPSHOT-SNAPSHOT".

I can find no apparent reason for that. Removing "-SNAPSHOT" from the gitTagToVersionNumber solves the issue, but removes the qualifier completely in other cases.

like image 736
F30 Avatar asked Sep 20 '16 08:09

F30


1 Answers

sbt-git will append an additional qualifier when there are uncommited changes in the Git working copy during the build.

By default, this qualifier is set to "SNAPSHOT". One can change it through the uncommittedSignifier setting, e.g.:

git.uncommittedSignifier := Some("DIRTY")
like image 127
F30 Avatar answered Sep 29 '22 23:09

F30