Created
March 24, 2017 20:31
-
-
Save gleenn/a8a604ebfa807bcd2a8c3341b3573657 to your computer and use it in GitHub Desktop.
add Git SHA to uberjar for Leiningen which can be read at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Add this to your :profile section in your project.clj: | |
:uberjar {:aot [spark.core] | |
:injections [(require '[clojure.java.shell :as shell]) | |
(spit "resources/version.txt" | |
(clojure.string/trimr | |
(:out | |
(shell/sh "git" "rev-parse" "HEAD"))))]} | |
; You can read the file during runtime like this: | |
(if-let [resource (clojure.java.io/resource "version.txt")] | |
(prn (slurp resource))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment