No description
Find a file
Hugo Duncan 942cbee34a Fix jar task for :classifiers
The classified jar files were not being generated due to incorrect
arguments in code.
2014-10-24 21:08:55 -04:00
bin Fix broken lein self-install 2014-09-29 22:51:36 +09:00
doc make it clearer that the :signing key is first-level 2014-10-20 14:13:41 +02:00
lein-pprint Release lein-pprint 1.1.2, allows running outside projects. 2014-09-12 10:37:53 -07:00
leiningen-core Don't change order of included profiles; fixes #1740 2014-10-24 16:06:27 -04:00
resources Bump all Clojure 1.5.1 deps to 1.6.0. 2014-03-26 13:43:38 +01:00
src/leiningen Fix jar task for :classifiers 2014-10-24 21:08:55 -04:00
test Fix jar task for :classifiers 2014-10-24 21:08:55 -04:00
test_projects Fix jar task for :classifiers 2014-10-24 21:08:55 -04:00
.gitattributes Added .gitattributes to avoid autocrlf for bat files 2010-12-31 22:22:56 -08:00
.gitignore Be explicit about which .nrepl-port files to ignore 2014-04-19 14:15:24 -04:00
.travis.yml run travis tests with oraclejdk8 2014-03-28 15:35:21 -07:00
bash_completion.bash Improve namespace completion performance 2012-05-10 11:27:26 +02:00
CONTRIBUTING.md A few documentation changes. 2014-09-09 16:25:46 -07:00
COPYING Revert license back to official EPL; addresses #1446. 2014-02-12 13:42:53 -08:00
NEWS.md Update NEWS and clarify uses of GPG. 2014-10-11 20:16:26 -07:00
pcmpl-lein.el Clarify that pcmpl-lein.el is not part of Leiningen. 2013-05-17 13:46:44 -07:00
project.clj Bump stencil to 0.3.5. 2014-10-23 14:41:11 -07:00
README.md A few documentation changes. 2014-09-09 16:25:46 -07:00
sample.project.clj Add LEIN_NO_USER_PROFILES to sample.project.clj 2014-10-16 21:49:42 -04:00
TUTORIAL.md fix broken link 2011-08-11 20:11:18 -05:00
zsh_completion.zsh Check if in a lein project before ns completion 2014-08-18 13:26:53 -05: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 offers a recent version of Leiningen, try that first. Many package managers still include version 1.x, which is rather outdated, so you may be better off installing manually.

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 a Java JDK version 6 or later.
  2. Download the lein script from the stable branch of this project.
  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)
  5. Run it.

Windows

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

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

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.5.1"]]
  :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.

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

License

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.