Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Leiningen and Clojure CLI tools and how should I use them?

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?

like image 478
theJian Avatar asked Nov 11 '18 14:11

theJian


People also ask

What is Leiningen Clojure?

Leiningen is a modern build system for our Clojure projects. It's also written and configured entirely in Clojure. It works similarly to Maven, giving us a declarative configuration that describes our project, without needing to configure exact steps to be executed.


1 Answers

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.

like image 165
lukaszkorecki Avatar answered Oct 22 '22 00:10

lukaszkorecki