Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Including a build number in Clojure using boot
;; core.clj
(defn version []
(or (some-> "version.txt" slurp clojure.string/trim)
;; build.boot
(defn get-version []
(or (System/getenv "CIRCLE_SHA1") "SNAPSHOT"))
(deftask add-version-txt
"Add a file called version.txt to the fileset, for inclusion in the jar"
(with-pre-wrap fs
(let [t (tmp-dir!)]
(spit ( t "version.txt") (get-version))
(-> fs (add-resource t) commit!))))
(deftask dist ;; this is just an example - adapt your `dist` task
(pom :project 'example
:version (get-version))
(aot :namespace '#{example.core})
(jar :main 'example.core,
:file "example.jar")
(target :dir #{"target"})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment