I have some values repeated in my project.clj
like below:
(defproject foo "0.1.0-SNAPSHOT"
...
:dependencies [[bar "3.4.5"]
[baz "3.4.5"]
[bat "3.4.5"]]
...)
I would like to use some sort of constant here so, when these libraries get updated to 3.5.0
for example, I have to change just one place.
What is the best practise here? Best I can come up with is this:
(def deps-version "3.4.5")
(defproject foo "0.1.0-SNAPSHOT"
...
:dependencies [[bar ~deps-version]
[baz ~deps-version]
[bat ~deps-version]]
...)
Using a definition before defproject
is totally fine and common practice.
You can also so more advanced stuff like depending on the build environment (I would tag the effective project version too that case). A nice example is found in the answers to this question "Leiningen: How to define constants in project.clj?"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With