Skip to content
Newer
Older
100644 126 lines (90 sloc) 4.78 KB
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
1 # Leiningen
2
410b4e7 @technomancy This is not 1.0-level material... yet.
authored Nov 11, 2009
3 > "Leiningen!" he shouted. "You're insane! They're not creatures you can
4 > fight--they're an elemental--an 'act of God!' Ten miles long, two
5 > miles wide--ants, nothing but ants! And every single one of them a
6 > fiend from hell...
7 > -- from Leiningen Versus the Ants by Carl Stephenson
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
8
9 Leiningen is a build tool for Clojure designed to not set your hair on fire.
10
c5ba551 @technomancy Add motivation to README
authored Nov 14, 2009
11 Building Clojure projects with tools designed for Java can be an
12 exercise in frustration. If you use Ant, you end up copying around a
13 lot of the same tasks around between XML files on all your projects;
14 there's a lot of repetition. Maven avoids repetition, but provides
15 very little transparency into what's really going on behind the scenes
16 and forces you to become a Maven expert to script a nontrivial
17 build. Either way you end up writing far more XML than is necessary.
18
19 With Leiningen, your build is described using Clojure. You can put any
20 code you like in your project.clj file; the only requirement is that
21 it includes a call to defproject. You can define your own tasks in
22 there if you need to, but the majority of projects should be able to
23 get by on the tasks that are provided with Leiningen. If you do find a
24 common task that you need to add, you can implement it as a plugin
25 rather than copying and pasting among each of your projects.
26
410b4e7 @technomancy This is not 1.0-level material... yet.
authored Nov 12, 2009
27 ## Installation
b62c7c0 @technomancy Added temporary install note.
authored Nov 1, 2009
28
3ad2025 @technomancy Clarify installation instructions.
authored Nov 14, 2009
29 Copy bin/lein to a location on your $PATH and run: $ lein self-install
b62c7c0 @technomancy Added temporary install note.
authored Nov 2, 2009
30
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
31 ## Usage
32
33 $ lein deps # install dependencies in lib/
34
73115a5 Added test namespace/task.
Phil Hagelberg authored Nov 1, 2009
35 $ lein test [PRED] # run the project's tests, optionally filtered on PRED
36
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
37 $ lein compile # ahead-of-time compile into classes/
38
39 $ lein repl # launch a REPL with the project classpath configured
40
c558fe9 @technomancy Add clean command.
authored Nov 8, 2009
41 $ lein clean # remove all build artifacts
42
91f5d54 @technomancy Add jar and uberjar commands.
authored Nov 8, 2009
43 $ lein jar # create a jar of the project
44
45 $ lein uberjar # create a standalone jar that contains all dependencies
46
6dfa557 @technomancy Add pom task.
authored Nov 15, 2009
47 $ lein pom # output a pom.xml file describing the project
48
49 TODO: install, new, help, deploy
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
50
51 ## Configuration
52
79b969b @technomancy Move away from build.clj to project.clj.
authored Nov 5, 2009
53 Place a project.clj file in the project root that looks something like this:
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
54
ddf403d @technomancy Spin off swank into a subproject.
authored Nov 14, 2009
55 (defproject leiningen "0.5.0-SNAPSHOT"
1d4aace @technomancy Oops; forgot to update dependency notation in readme.
authored Nov 14, 2009
56 :dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"]
57 [org.clojure/clojure-contrib "1.0-SNAPSHOT"]
ddf403d @technomancy Spin off swank into a subproject.
authored Nov 15, 2009
58 [ant/ant-launcher "1.6.2"]
59 [org.apache.maven/maven-ant-tasks "2.0.10"]]
60 :dev-dependencies [[org.clojure/swank-clojure "1.0"]])
42cdf1f @technomancy Version is no longer optional in defproject.
authored Nov 14, 2009
61
62 Other keys you can set are :namespaces to compile if you don't want
63 all of them AOT'd as well as a :main namespace for building executable jars.
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
64
b3e0233 @technomancy Added FAQ, License.
authored Nov 4, 2009
65 ## FAQ
66
0802503 @technomancy Fix markdown in readme.
authored Nov 5, 2009
67 **Q:** How do you pronounce Leiningen?
68 **A:** It's LINE-ing-en. I think.
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
69
0802503 @technomancy Fix markdown in readme.
authored Nov 6, 2009
70 **Q:** What does this offer over [Lancet](http://github.com/stuarthalloway/lancet)?
71 **A:** Lancet is more of a library than a build tool. It doesn't predefine
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
72 any tasks apart from what Ant itself offers, so there is nothing
42cdf1f @technomancy Version is no longer optional in defproject.
authored Nov 14, 2009
73 Clojure-specific in it. Leiningen builds on Lancet, but takes
74 things further. In addition, it includes some Maven functionality
75 for dependencies.
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
76
0802503 @technomancy Fix markdown in readme.
authored Nov 6, 2009
77 **Q:** But Maven is terrifying!
78 **A:** That's not a question. Anyway, Leiningen only uses the dependency
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
79 resolution parts of Maven, which are quite tame. For the actual
80 task execution cycles it uses Ant under the covers via Lancet.
81
0802503 @technomancy Fix markdown in readme.
authored Nov 6, 2009
82 **Q:** But Ant is terrifying!
83 **A:** That's [true](http://www.defmacro.org/ramblings/lisp.html). Ant is
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
84 an interpreter for a [procedural language with a regrettable
85 syntax](http://blogs.tedneward.com/2005/08/22/When+Do+You+Use+XML+Again.aspx).
86 But if you're able to write it with a more pleasing syntax, it's
87 not so bad.
88
0802503 @technomancy Fix markdown in readme.
authored Nov 6, 2009
89 **Q:** What happened to [Corkscrew](http://github.com/technomancy/corkscrew)?
90 **A:** I tried, but I really couldn't make the wine metaphor work. That,
b3e0233 @technomancy Added FAQ, License.
authored Nov 5, 2009
91 and the Plexus Classworlds container was an ornery beast causing
92 much frustration.
93
0802503 @technomancy Fix markdown in readme.
authored Nov 6, 2009
94 **Q:** What about Windows?
95 **A:** Patches welcome.
96
fc931d8 @technomancy Added a note about bootstrapping.
authored Nov 14, 2009
97 ## Hacking
98
99 Working on the Leiningen codebase has a few unique challenges since
100 there's a bit of a chicken-and-egg bootstrap problem. To go from a
101 clean checkout to a working environment, the following steps are
102 necessary:
103
104 0. Place bin/lein on your $PATH somewhere.
105 1. Do a self-install of leiningen (from outside the checkout tree).
106 2. Place ~/.leiningen.jar in lib.
107 3. Invoke "lein compile" followed by "lein deps".
108 4. Remove .leiningen.jar from lib.
109 5. Invoke "lein uberjar", and place the jar in ~/.leiningen.jar for
110 future use.
111
c5ba551 @technomancy Add motivation to README
authored Nov 15, 2009
112 Leiningen is extensible, you can define new tasks in plugins. Add your
113 plugin as a dev-dependency of your project, and you'll be able to call
114 "lein $YOUR_COMMAND". See the lein-swank directory for an example of a
115 plugin.
ddf403d @technomancy Spin off swank into a subproject.
authored Nov 15, 2009
116
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
117 ## License
118
119 Copyright (C) 2009 Phil Hagelberg
120
79b969b @technomancy Move away from build.clj to project.clj.
authored Nov 6, 2009
121 Thanks to Stuart Halloway for Lancet and Tim Dysinger for convincing
122 me that good builds are important.
123
88b5360 @technomancy Initial commit.
authored Oct 31, 2009
124 Distributed under the Eclipse Public License, the same as Clojure
125 uses. See the file COPYING.
Something went wrong with that request. Please try again.