Is there a fork of sbt-git without JGit?


#1

Does anyone know whether there exists a fork of sbt-git that does not use JGit? It seems that JGit has bugs in it (sbt-git issue 161).

Specifically, what I am using sbt-git for is to automatically set the version of my project via git describe. This frequently does the wrong thing with the current sbt-git - it seems that JGit has issues properly dealing with tags. Wanted to ask if anyone has already run into this and has a fork (that uses git via the shell or something like that). Thank you


(Claudio Bley) #2

Hi.

We use sbt-dynver instead which just calls out to git and does not use JGit AFAIK.

HTH


#3

Thanks for the suggestion. This seems promising. However, “In order to be recognized by sbt-dynver, tags must begin with the lowercase letter ‘v’ followed by a digit.” We do not use ‘v’ in our versions. I will look to see whether this requirement can be worked around.


(Renato) #4

It will be interesting to know if that’s a real limitation or something arbitrary that could be changed in the plugin. Eventually, a PR to make it optional will certainly be interesting.

/cc @dwijnand


(Dale Wijnand) #5

I’d be happy to review a pull request that allows for the ‘v’ to be optional. Actually we could make the whole --match argument (of git describe) a configurable setting key.


#6

In production, we are using sbt-git (to dynamically grab the version). In development, we do not use sbt-git and instead use version := "1.2.3" in our build.sbt. We then use sbt docker:publishLocal to package the build in a docker image. I am noticing that sporadically, our non-production builds fail to capture the version variable that is clearly there in the build.sbt file and instead of building foo-service_2.12-1.2.3.jar, I instead get foo-service_2.12.jar (with a bunch of “SNAPSHOT” output as well, indicating that the build failed to capture the right version).

Perhaps my issue with sbt-git above is partially (or fully) due to this underlying issue with either sbt or the docker plugin. Does anyone have any suggestions for further debugging or resolving this?