I'm playing around with Clojure recently. The most loved dependency management tool in the Clojure ecosystem is Leiningen to my knowledge. But I also found Clojure has provided CLI tools which probably could replace Leiningen. Due to the limitation of experience in Clojure, I do not quite understand the difference between Leiningen and those CLI tools. I heard those CLI tools is much lightweight, what does it mean? How should I use them?
Asked
Active
Viewed 5,192 times
1 Answers
13
CLI tools are more limited in scope than Leiningen - it's a small tool which you can use to launch a REPL quickly. Combined with tools.deps.alpha
it can be used to run code and pull in 3rd party dependencies. You can read more about it here.
Leiningen can do all of that, plus:
- create deployment artifacts (uberjars)
- start a REPL server or connect to a running one
- manage mixed projects (for example Clojure + Java or Clojure + Clojurescript)
- run arbitrary tasks in your project
- manage dependencies
- plugin support (linters, deployment tools)
- integrate with Maven
The Lein repository includes a sample project file, sample.project.clj, which is a bit overwhelming but shows all the things Lein can do.
At this point, Lein is more useful for building applications and libraries - as it has all the features you might need to do that. That said, CLI tools + tools.deps
is quickly gaining traction and there are projects which add all the missing bits from Leiningen, but you have to combine them yourself.

lukaszkorecki
- 1,743
- 1
- 15
- 19
-
1this answer is outdated (was true at some point) but not CLI can do all that and super seeds leiningen on most clojure open source projects. – Vlad A. Jan 24 '20 at 08:57
-
2@andy Interesting - do you have any evidence to back that? Based on the most recent Clojure Survey (2020, https://clojure.org/news/2020/02/20/state-of-clojure-2020) - Lein is used by nearly 90% of respondents, while clj cli is roughly used by 50%. I'd still say, that Lein offers better out of the box experience, even without plugins - especially the uberjar command. – lukaszkorecki Mar 08 '20 at 03:54
-
I agree, I've gone back and forth with this since I wrote that comment, and we're good either way. The only advantage I can still find in CLI is that it integrates figwheel with out of the box and no configs on user part, and also I love the straight-from-github dependency pulling in deps.edn. But it's a simple matter of preference. Thank you for your reply tho, I stand corrected. – Vlad A. Mar 25 '20 at 16:26
-
1No problem Andy - I hope that eventually deps somehow merges with Lein (for example replaces its dependency management, and makes Leiningen more of a project task runner sort of thing). – lukaszkorecki Mar 26 '20 at 17:56
-
The answer may still be true in some areas. I find this a bit overwhelming https://github.com/EwenG/badigeon – ruby_object Jul 03 '21 at 16:57
-
Yep, I hope that we will see some convergence soon - it must be really confusing for newcomers. – lukaszkorecki Jul 04 '21 at 17:07