I am using sbt-assembly plugin to build a fat Jar for my scala project. Is there a way I can include git commit id in the jar manifest, something similar to what git-commit-id-plugin
does for maven.
Thanks
I am using sbt-assembly plugin to build a fat Jar for my scala project. Is there a way I can include git commit id in the jar manifest, something similar to what git-commit-id-plugin
does for maven.
Thanks
Old question but there I go...
You could use sbt-git plugin with sbt-assembly for including git information in your MANIFEST.MF
file.
For adding information to your MANIFEST.MF
file you can use the packageOptions
sbt key in this way:
import sbt.Package.ManifestAttributes
import com.typesafe.sbt.SbtGit.git
packageOptions := Seq(ManifestAttributes(("Repository-Commit", git.gitHeadCommit.value.get)))
See example over here: spark-authorizer
This information will be stored in your MANIFEST.MF
file included in the fat jar generated by sbt-assembly :
Manifest-Version: 1.0
Implementation-Title: spark-authorizer
Repository-Commit: 12538262c1be14800eb820163de6c46cdbd69c99
Implementation-Version: 0.1.0-SNAPSHOT
Specification-Vendor: de.example.playground.spark.authorizer
Specification-Title: spark-authorizer
Implementation-Vendor-Id: de.example.playground.spark.authorizer
Specification-Version: 0.1.0-SNAPSHOT
Implementation-Vendor: de.example.playground.spark.authorizer
You can add as many values as you want to packageOptions
. All of them will be included in the MANIFEST.MF file.