Leiningen

Leiningen for me it’s the equivalent of Maven for Clojure. The Clojure community has been moving to deps.edn but Leiningen still has a place in my heart.

The most important commands are:

Create a new project

Terminal window
lein new app <project-name>

Running tests

Terminal window
lein test

Running the project

Terminal window
lein run

Profiles

Projects can define custom profiles on their project.clj. It’s also possible to define a profile in ~/.lein/profiles.clj that will be used by all projects.

My leinigen profile

~/.lein/profiles.clj
{:user {:plugins [[lein-ancient "1.0.0-RC3"] ;; `lein ancient` shows outdated dependencies
[lein-pprint "1.3.2"] ;; `lein pprint` print dependencies in a tree format
[metosin/bat-test "0.4.4"] ;; test runner `lein bat-test`, `lein bat-test auto`
[dev.weavejester/lein-cljfmt "0.12.0"] ;; formatting code with `lein cljfmt check/fix`
]}}
Back to notes