Leiningen: How to define constants in project.clj?

I have several values ​​repeated in my project.clj , as shown 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 constant here, so when these libraries are updated to 3.5.0 , for example, I only need to change one place.

What is the best practice here? Best of all, I can come up with the following:

 (def deps-version "3.4.5") (defproject foo "0.1.0-SNAPSHOT" ... :dependencies [[bar ~deps-version] [baz ~deps-version] [bat ~deps-version]] ...) 
+7
clojure leiningen
source share
1 answer

Using the definition before defproject is a completely fine and accepted practice.

You can also use more advanced elements, for example, depending on the build environment (I would mark the effective version of the project in this case as well). A good example can be found in the answers to this question " Leiningen: How to define constants in project.clj? "

+1
source share