No description
Find a file
2013-03-14 23:32:55 +01:00
bin Point people to the right place for bootstrapping instructions. 2013-03-14 10:46:55 -07:00
doc Document non-traditional javac compilation order. (from Quoll) Fixes #847. 2013-03-09 17:21:26 -08:00
lein-pprint Once upgraded to 1.1.1, lein2 pprint showed the output (it didn't work with the previous version - no output shown) 2012-04-08 12:57:43 +03:00
leiningen-core Use RevivableInputStream to avoid blocking reads. 2013-03-14 23:32:54 +01:00
resources Use Clojure 1.5.1 in lein new templates 2013-03-14 00:21:42 +04:00
src/leiningen No need to pump from sysin for javac. 2013-03-14 23:32:55 +01:00
test Specify :root in repl test so the stub works 2013-03-14 10:47:28 -05:00
test_projects Test :provided profile interpretation by the uberjar task. 2012-11-17 17:38:11 -05:00
.gitattributes Added .gitattributes to avoid autocrlf for bat files 2010-12-31 22:22:56 -08:00
.gitignore Add download log parsing code. 2013-01-21 20:43:41 -08:00
.travis.yml Go back up a directory for travis test run 2013-03-14 10:57:03 -05:00
bash_completion.bash Improve namespace completion performance 2012-05-10 11:27:26 +02:00
CONTRIBUTING.md Add alias for bootstrap in leningen-core 2013-03-12 22:58:50 -04:00
COPYING Clarify license of images. 2011-07-19 19:04:15 -07:00
NEWS.md Add news about interrupt-on-repl-input 2013-03-14 14:02:21 -05:00
pcmpl-lein.el Add pcmpl-lein.el for eshell completion. 2011-01-15 10:38:41 -05:00
project.clj Bump clj-http version. 2013-03-14 11:58:13 -07:00
README.md Replace curl/wget usage in lein.bat with powershell. 2013-02-26 10:38:37 -08:00
sample.project.clj Update sample.project.clj 2013-03-04 04:02:28 +04:00
todo.org Fix upgrade command. 2013-01-11 11:06:09 -08:00
TUTORIAL.md fix broken link 2011-08-11 20:11:18 -05:00
zsh_completion.zsh Don't complete for test! anymore. 2012-08-08 07:04:51 -04:00

Leiningen

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.

Installation

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 installs its dependencies upon the first run on unix, so the first run will take longer.

  1. Download the script.
  2. Place it on your $PATH. (I like to use ~/bin)
  3. Set it to be executable. (chmod 755 ~/bin/lein)

There is still a lot of extant material on the Web concerning the older Leiningen 1.x version, which is still available if you need to work on older projects that aren't compatible with 2.x yet. The upgrade guide has instructions on migrating to version 2.

On Windows most users can get the batch file and run lein self-install. 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.

Configuration

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 "http://github.com/technomancy/myproject"
  :dependencies [[org.clojure/clojure "1.4.0"]]
  :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.

Documentation

Leiningen documentation is organized as a number of guides:

Plugins

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.

License

Source Copyright © 2009-2013 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.