2009-10-31 21:35:25 +00:00
|
|
|
# Leiningen
|
|
|
|
|
2009-11-12 05:25:16 +00:00
|
|
|
> "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
|
2009-10-31 21:35:25 +00:00
|
|
|
|
|
|
|
Leiningen is a build tool for Clojure designed to not set your hair on fire.
|
|
|
|
|
2009-11-12 05:25:16 +00:00
|
|
|
## Installation
|
2009-11-02 07:02:16 +00:00
|
|
|
|
2009-11-15 01:18:56 +00:00
|
|
|
Copy bin/lein to a location on your $PATH and run: $ lein self-install
|
2009-11-02 07:02:16 +00:00
|
|
|
|
2009-10-31 21:35:25 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
$ lein deps # install dependencies in lib/
|
|
|
|
|
2009-11-02 06:47:21 +00:00
|
|
|
$ lein test [PRED] # run the project's tests, optionally filtered on PRED
|
|
|
|
|
2009-10-31 21:35:25 +00:00
|
|
|
$ lein compile # ahead-of-time compile into classes/
|
|
|
|
|
|
|
|
$ lein repl # launch a REPL with the project classpath configured
|
|
|
|
|
2009-11-09 06:09:39 +00:00
|
|
|
$ lein clean # remove all build artifacts
|
|
|
|
|
2009-11-09 06:11:31 +00:00
|
|
|
$ lein jar # create a jar of the project
|
|
|
|
|
|
|
|
$ lein uberjar # create a standalone jar that contains all dependencies
|
|
|
|
|
2009-11-09 06:23:00 +00:00
|
|
|
$ lein swank [PORT] # launch swank server for Emacs to connect
|
|
|
|
|
2009-11-14 22:24:36 +00:00
|
|
|
TODO: install, new, help, deploy, pom
|
2009-10-31 21:35:25 +00:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2009-11-06 04:36:27 +00:00
|
|
|
Place a project.clj file in the project root that looks something like this:
|
2009-10-31 21:35:25 +00:00
|
|
|
|
2009-11-15 04:47:48 +00:00
|
|
|
(defproject leiningen "0.5.0-SNAPSHOT"
|
2009-11-14 23:36:10 +00:00
|
|
|
:dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"]
|
|
|
|
[org.clojure/clojure-contrib "1.0-SNAPSHOT"]
|
2009-11-15 04:47:48 +00:00
|
|
|
[ant/ant-launcher "1.6.2"]
|
|
|
|
[org.apache.maven/maven-ant-tasks "2.0.10"]]
|
|
|
|
:dev-dependencies [[org.clojure/swank-clojure "1.0"]])
|
2009-11-14 22:24:36 +00:00
|
|
|
|
|
|
|
Other keys you can set are :namespaces to compile if you don't want
|
|
|
|
all of them AOT'd as well as a :main namespace for building executable jars.
|
2009-10-31 21:35:25 +00:00
|
|
|
|
2009-11-05 04:25:13 +00:00
|
|
|
## FAQ
|
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** How do you pronounce Leiningen?
|
|
|
|
**A:** It's LINE-ing-en. I think.
|
2009-11-05 04:25:13 +00:00
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** What does this offer over [Lancet](http://github.com/stuarthalloway/lancet)?
|
|
|
|
**A:** Lancet is more of a library than a build tool. It doesn't predefine
|
2009-11-05 04:25:13 +00:00
|
|
|
any tasks apart from what Ant itself offers, so there is nothing
|
2009-11-14 22:24:36 +00:00
|
|
|
Clojure-specific in it. Leiningen builds on Lancet, but takes
|
|
|
|
things further. In addition, it includes some Maven functionality
|
|
|
|
for dependencies.
|
2009-11-05 04:25:13 +00:00
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** But Maven is terrifying!
|
|
|
|
**A:** That's not a question. Anyway, Leiningen only uses the dependency
|
2009-11-05 04:25:13 +00:00
|
|
|
resolution parts of Maven, which are quite tame. For the actual
|
|
|
|
task execution cycles it uses Ant under the covers via Lancet.
|
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** But Ant is terrifying!
|
|
|
|
**A:** That's [true](http://www.defmacro.org/ramblings/lisp.html). Ant is
|
2009-11-05 04:25:13 +00:00
|
|
|
an interpreter for a [procedural language with a regrettable
|
|
|
|
syntax](http://blogs.tedneward.com/2005/08/22/When+Do+You+Use+XML+Again.aspx).
|
|
|
|
But if you're able to write it with a more pleasing syntax, it's
|
|
|
|
not so bad.
|
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** What happened to [Corkscrew](http://github.com/technomancy/corkscrew)?
|
|
|
|
**A:** I tried, but I really couldn't make the wine metaphor work. That,
|
2009-11-05 04:25:13 +00:00
|
|
|
and the Plexus Classworlds container was an ornery beast causing
|
|
|
|
much frustration.
|
|
|
|
|
2009-11-06 04:34:14 +00:00
|
|
|
**Q:** What about Windows?
|
|
|
|
**A:** Patches welcome.
|
|
|
|
|
2009-11-14 23:06:21 +00:00
|
|
|
## Hacking
|
|
|
|
|
|
|
|
Working on the Leiningen codebase has a few unique challenges since
|
|
|
|
there's a bit of a chicken-and-egg bootstrap problem. To go from a
|
|
|
|
clean checkout to a working environment, the following steps are
|
|
|
|
necessary:
|
|
|
|
|
|
|
|
0. Place bin/lein on your $PATH somewhere.
|
|
|
|
1. Do a self-install of leiningen (from outside the checkout tree).
|
|
|
|
2. Place ~/.leiningen.jar in lib.
|
|
|
|
3. Invoke "lein compile" followed by "lein deps".
|
|
|
|
4. Remove .leiningen.jar from lib.
|
|
|
|
5. Invoke "lein uberjar", and place the jar in ~/.leiningen.jar for
|
|
|
|
future use.
|
|
|
|
|
2009-11-15 04:47:48 +00:00
|
|
|
Leiningen is extensible, you can define new commands in plugins. Add
|
|
|
|
your plugin as a dev-dependency of your project, and you'll be able to
|
|
|
|
call "lein $YOUR_COMMAND". See the lein-swank directory for an example
|
|
|
|
of a plugin.
|
|
|
|
|
2009-10-31 21:35:25 +00:00
|
|
|
## License
|
|
|
|
|
|
|
|
Copyright (C) 2009 Phil Hagelberg
|
|
|
|
|
2009-11-06 04:36:27 +00:00
|
|
|
Thanks to Stuart Halloway for Lancet and Tim Dysinger for convincing
|
|
|
|
me that good builds are important.
|
|
|
|
|
2009-10-31 21:35:25 +00:00
|
|
|
Distributed under the Eclipse Public License, the same as Clojure
|
|
|
|
uses. See the file COPYING.
|