leiningen/resources/leiningen/help
2012-05-24 18:26:46 -07:00
..
copying Support static docs in help task. (readme, tutorial, news, licensing.) 2010-12-01 22:11:53 -08:00
deploying Move "deploy" help to "deploying" to avoid collision. 2011-07-19 19:03:47 -07:00
faq Spin FAQ off into its own page. 2012-05-23 21:27:17 -07:00
news Update the news symlink to point at NEWS.md 2012-05-11 08:25:44 -04:00
profiles Spin off separate profile guide from readme/tutorial. 2012-05-24 18:26:46 -07:00
readme Support static docs in help task. (readme, tutorial, news, licensing.) 2010-12-01 22:11:53 -08:00
sample Add sample.project.clj to static-help pages. 2010-12-24 20:48:10 -08:00
tutorial Move docs to doc/ directory. 2011-07-01 10:32:38 -07:00

# Leiningen

<img src="https://github.com/downloads/technomancy/leiningen/leiningen-banner.png"
 alt="Leiningen logo" title="The man himself" align="right" />

> "Leiningen!" he shouted. "You're insane! They're not creatures you can
> fight&mdash;they're an elemental&mdash;an 'act of God!' Ten miles long, two
> miles wide&mdash;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](https://github.com/technomancy/leiningen/wiki/Packaging)
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](https://raw.github.com/technomancy/leiningen/stable/bin/lein).
2. Place it on your `$PATH`. (I like to use `~/bin`)
3. Set it to be executable. (`chmod 755 ~/bin/lein`)

The link above will get you the stable release. The Leiningen 2
[preview release](https://raw.github.com/technomancy/leiningen/preview/bin/lein)
has some great new features, but not all projects and plugins have
been upgraded to work with it yet. Please see the
[upgrade guide](https://github.com/technomancy/leiningen/wiki/Upgrading)
for instructions on migrating to version 2.

On Windows most users can get
[the batch file](https://raw.github.com/technomancy/leiningen/stable/bin/lein.bat).
If you have wget.exe or curl.exe already installed and in PATH, you
can just run `lein self-install`, otherwise get the standalone jar from the
[downloads page](https://github.com/technomancy/leiningen/downloads).
If you have [Cygwin](http://www.cygwin.com/) you should be able to use
the shell script above rather than the batch file.

## Basic Usage

The
[tutorial](https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md)
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 commas:

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

See the [FAQ](https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md)
for more details.

## Configuration

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

```clj
(defproject myproject "0.5.0-SNAPSHOT"
  :description "A project for doing things."
  :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](https://github.com/technomancy/leiningen/blob/preview/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](https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md).

## Plugins

Leiningen supports plugins which may contain both new tasks and hooks
that modify behaivour of existing tasks. See
[the plugins wiki page](https://github.com/technomancy/leiningen/wiki/Plugins)
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 from `~/.lein/profiles.clj`. The
[plugin guide](https://github.com/technomancy/leiningen/blob/preview/doc/PLUGINS.md)
explains how to write plugins.

## Contributing

Please report issues on the
[GitHub issue tracker](https://github.com/technomancy/leiningen/issues)
or the [mailing list](http://groups.google.com/group/leiningen).
Personal email addresses are **not** appropriate for bug reports. See
the
[readme for the leiningen-core library](https://github.com/technomancy/leiningen/blob/master/leiningen-core/README.md)
and `doc/PLUGINS.md` for more details on how Leiningen's codebase is
structured. Design discussions also occur in the
[#leiningen channel on Freenode](irc://chat.freenode.net#leiningen).

Patches are preferred as GitHub pull requests, though patches from
`git format-patch` are also welcome on the mailing list. Please use
topic branches when sending pull requests rather than committing
directly to master in order to minimize unnecessary merge commit
clutter.

Contributors who have had a single patch accepted may request commit
rights on the mailing list or in IRC. Please use your judgment
regarding potentially-destabilizing work and branches. Other
contributors will usually be glad to review topic branches before
merging if you ask on IRC or the mailing list.

Contributors are also welcome to request a free
[Leiningen sticker](http://twitpic.com/2e33r1) by asking on the
mailing list and mailing a self-addressed, stamped envelope.

## Building

You don't need to "build" Leiningen per se, but when you're using a
checkout you will need to get its dependencies in place.

For the master branch, use Leiningen 1.x to run `lein install` in the
`leiningen-core` subproject directory. When the dependencies change
you will also have to do `rm .lein-classpath` in the project root.

Once you've done that, symlink `bin/lein` to somewhere on your
`$PATH`, usually as `lein2` in order to keep it distinct from your
existing installation.

If you want to develop on the 1.x branch, this should be unnecessary.

## License

Source Copyright © 2009-2012 Phil Hagelberg, Alex Osborne, Dan Larkin, and
[contributors](https://github.com/technomancy/leiningen/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](https://github.com/downloads/technomancy/leiningen/leiningen-full.jpg)
available.