Skip to content
This repository

Automate Clojure projects without setting your hair on fire.

Merge pull request #1499 from cddr/ignore-nrepl-port

Ignore .nrepl-port at project roots
latest commit b8bc236fa4
Jean Niklas L'orange hyPiRion authored April 19, 2014
Octocat-spinner-32 bin Lower read time out for wagon-http January 24, 2014
Octocat-spinner-32 doc Document various ways to register wagon factories [fixes #1483] April 07, 2014
Octocat-spinner-32 lein-pprint Once upgraded to 1.1.1, lein2 pprint showed the output (it didn't wor… April 08, 2012
Octocat-spinner-32 leiningen-core Include group in dedupe key to fix #1480 April 15, 2014
Octocat-spinner-32 resources Bump all Clojure 1.5.1 deps to 1.6.0. March 26, 2014
Octocat-spinner-32 src Make Leiningen (more) Eastwood-friendly. April 03, 2014
Octocat-spinner-32 test Include group in dedupe key to fix #1480 April 15, 2014
Octocat-spinner-32 test_projects Bump all Clojure 1.5.1 deps to 1.6.0. March 26, 2014
Octocat-spinner-32 .gitattributes Added .gitattributes to avoid autocrlf for bat files December 31, 2010
Octocat-spinner-32 .gitignore Be explicit about which .nrepl-port files to ignore April 19, 2014
Octocat-spinner-32 .travis.yml run travis tests with oraclejdk8 March 28, 2014
Octocat-spinner-32 Re-word contributing message. July 24, 2013
Octocat-spinner-32 COPYING Revert license back to official EPL; addresses #1446. February 12, 2014
Octocat-spinner-32 Release 2.3.4 November 18, 2013
Octocat-spinner-32 Bump copyright year. January 06, 2014
Octocat-spinner-32 fix broken link August 11, 2011
Octocat-spinner-32 bash_completion.bash Improve namespace completion performance May 10, 2012
Octocat-spinner-32 pcmpl-lein.el Clarify that pcmpl-lein.el is not part of Leiningen. May 17, 2013
Octocat-spinner-32 project.clj Tell Bultitude not to ignore unreadable namespaces in test/check. March 17, 2014
Octocat-spinner-32 sample.project.clj Document :clean-non-project-classes and reword help output. March 26, 2014
Octocat-spinner-32 zsh_completion.zsh Don't complete for test! anymore. August 08, 2012


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..."

  • from Leiningen Versus the Ants by Carl Stephenson

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


If your preferred package manager has a relatively recent version of Leiningen, try that first. Otherwise you can install by hand:

Leiningen bootstraps itself using the lein shell script; there is no separate install script. It handles installing its own dependencies, which means the first run will take longer.

  1. Make sure you have a Java JDK version 6 or later.
  2. Download the script.
  3. Place it on your $PATH. (~/bin is a good choice if it is on your path.)
  4. Set it to be executable. (chmod 755 ~/bin/lein)


There is an installer which will handle downloading and placing Leiningen and its dependencies.

The manual method of putting the batch file. on your PATH and running lein self-install should still work for most users. If you have Cygwin you should be able to use the shell script above rather than the batch file.

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

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.5.1"]]
  :plugins [[lein-ring "0.4.5"]])

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 contain both new tasks and hooks that modify behaviour of existing 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 swank-clojure) 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-2014 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. Full-size version available.

Something went wrong with that request. Please try again.