Project automation for Clojure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Phil Hagelberg b97ccd17d7 Relocation notice on web site. 4 months ago
.circleci Changelog bump; switch ci to jdk 17. 4 months ago
.github/ISSUE_TEMPLATE Update 4 years ago
bin bump version up to 2.9.11-SNAPSHOT 4 months ago
doc Codeberg doesn't use blob or tree in its URLs. 5 months ago
lein-pprint Update all links to point to codeberg instead of github. 5 months ago
leiningen-core bump version up to 2.9.11-SNAPSHOT 4 months ago
resources Update bootclasspath deps listing. 4 months ago
src/leiningen Expand profiles before calculating which to remove in jar task. 4 months ago
test Fix uberjar test to use input streams instead of relying on reflection. 4 months ago
test_projects Add test for dev-resources in uberjar. 4 months ago
web Relocation notice on web site. 4 months ago
.gitattributes Added .gitattributes to avoid autocrlf for bat files 12 years ago
.gitignore Update link to CI badge. 4 months ago
.woodpecker.yml Add IRC notifications for failed builds. 5 months ago Codeberg doesn't use blob or tree in its URLs. 5 months ago
COPYING tocontrol -> to control in LICENSE files 6 years ago Changelog bump; switch ci to jdk 17. 4 months ago Recommend manual install in /usr/local/bin 4 months ago
bash_completion.bash Remove 'swank' and add missing commands to bash completion. 7 years ago
pcmpl-lein.el Clarify that pcmpl-lein.el is not part of Leiningen. 10 years ago
project.clj bump version up to 2.9.11-SNAPSHOT 4 months ago
sample.project.clj Merge branch 'domain-socket-repl' into main 4 months ago
zsh_completion.zsh Check if in a lein project before ns completion 8 years ago



Leiningen logo

"Leiningen!" he shouted. "You're insane! They're not creatures you can fight—they're an elemental—an 'act of God!' Ten miles long, two miles wide—ants, nothing but ants! And every single one of them a fiend from hell..."

Leiningen is for automating Clojure projects without setting your hair on fire.

Note: the canonical repository for Leiningen is on Codeberg but we maintain a mirror on GitHub for the time being in order to ease the transition. Please update your links and git remotes.


If your preferred package manager offers a recent version of Leiningen, try that first.

Leiningen installs itself on the first run of the lein shell script; there is no separate install script. Follow these instructions to install Leiningen manually:

  1. Make sure you have Java installed; OpenJDK is recommended
  2. Download the lein script from the stable branch of this project
  3. Place it on your $PATH (/usr/local/bin for example)
  4. Set it to be executable. (sudo chmod +x /usr/local/bin/lein)
  5. Run it.

Windows users can use the above script in the Linux subsystem or try the batch file or Powershell version instead.

Basic Usage

The tutorial has a detailed walk-through of the steps involved in creating a new project, but here are the commonly-used tasks:

$ lein new [TEMPLATE] NAME # generate a new project skeleton

$ lein test [TESTS] # run the tests in the TESTS namespaces, or all tests

$ lein repl # launch an interactive REPL session

$ lein run -m my.namespace # run the -main function of a namespace

$ lein uberjar # package the project and dependencies as standalone jar

$ lein deploy clojars # publish the project to Clojars as a library

Use lein help to see a complete list. lein help $TASK shows the usage for a specific task.

You can also chain tasks together in a single command by using the do task with comma-separated tasks:

$ lein do clean, test foo.test-core, jar

Most tasks need to be run from somewhere inside a project directory to work, but some (new, help, search, version, and repl) may run from anywhere.


The project.clj file in the project root should look like this:

(defproject myproject "0.5.0-SNAPSHOT"
  :description "A project for doing things."
  :license "Eclipse Public License 1.0"
  :url ""
  :dependencies [[org.clojure/clojure "1.8.0"]]
  :plugins [[lein-tar "3.2.0"]])

The lein new task generates a project skeleton with an appropriate starting point from which you can work. See the sample.project.clj file (also available via lein help sample) for a detailed listing of configuration options.

The project.clj file can be customized further with the use of profiles.


Leiningen documentation is organized as a number of guides:




Leiningen supports plugins which may introduce new tasks. See the plugins wiki page for a full list. If a plugin is needed for successful test or build runs, (such as lein-tar) then it should be added to :plugins in project.clj, but if it's for your own convenience (such as lein-pprint) then it should be added to the :plugins list in the :user profile in ~/.lein/profiles.clj. See the profiles guide for details on how to add to your :user profile. The plugin guide explains how to write plugins.


Source Copyright © 2009-2022 Phil Hagelberg, Alex Osborne, Dan Larkin, and contributors. Distributed under the Eclipse Public License, the same as Clojure uses. See the file COPYING.

Thanks to Stuart Halloway for Lancet and Tim Dysinger for convincing me that good builds are important.

Images Copyright © 2010 Phil Hagelberg. Distributed under the Creative Commons Attribution + ShareAlike License 4.0. Full-size version available.