Permalink
Newer
Older
100644 224 lines (220 sloc) 12.8 KB
1
;; This is an annotated example of the options that may be set in a
2
;; project.clj file. It is a fairly contrived example in order to
3
;; cover all options exhaustively; it shouldn't be considered a
4
;; representative configuration. For a more detailed explanation of
5
;; some of the terms run "lein help tutorial".
7
;; These options apply to Leiningen 2.x. See the 1.x branch for older versions:
8
;; https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj
9
10
;; The project is named "sample", and its group-id is "org.example".
11
(defproject org.example/sample "1.0.0-SNAPSHOT" ; version "1.0.0-SNAPSHOT"
12
;; Beyond this point you may prepend a form with unquote, or ~, to eval it.
13
14
;; The descrption text is searchable from repositories like Clojars.
15
:description "A sample project"
16
:url "http://example.org/sample-clojure-project"
17
;; The mailing list of the project. If the project has multiple mailing
18
;; lists, use the :mailing-lists key (bound to a seq of mailing list
19
;; descriptions as below).
20
:mailing-list {:name "sample mailing list"
21
:archive "http://example.org/sample-mailing-list-archives"
Jul 13, 2010
22
:other-archives ["http://example.org/sample-list-archive2"
23
"http://example.org/sample-list-archive3"]
24
:post "list@example.org"
25
:subscribe "list-subscribe@example.org"
26
:unsubscribe "list-unsubscribe@example.org"}
27
;; The project's license. :distribution should be :repo or :manual;
28
;; :repo means it is ok for public repositories to host this project's
29
;; artifacts. A seq of :licenses is also supported.
30
:license {:name "Eclipse Public License - v 1.0"
31
:url "http://www.eclipse.org/legal/epl-v10.html"
32
:distribution :repo
33
:comments "same as Clojure"}
34
;; Dependencies are listed as [group-id/name version].
35
:dependencies [[org.clojure/clojure "1.3.0"]
36
[org.jclouds/jclouds "1.0" :classifier "jdk15" :scope "test"]
37
[net.sf.ehcache/ehcache "2.3.1" :extension "pom"]
38
[log4j "1.2.15" :exclusions [[javax.mail/mail :extension "jar"]
39
[javax.jms/jms :classifier "*"]
40
com.sun.jdmk/jmxtools
41
com.sun.jmx/jmxri]]]
42
;; Global exclusions are applied across the board, as an alternative
43
;; to duplication for multiple depedencies with the same excluded libraries.
44
:exclusions [org.apache.poi/poi
45
org.apache.poi/poi-ooxml]
46
;; Plugins are code that runs in Leiningen itself and usually
47
;; provides new tasks or hooks.
48
:plugins [[lein-pprint "1.1.1"]
49
[lein-assoc "0.1.0"]
50
[s3-wagon-private "1.1.1"]]
51
;; If you configure a custom repository with a self-signed SSL
52
;; certificate, you will need to add it here. Paths should be either
53
;; be on Leiningen's classpath or relative to the project root.
54
:certificates ["blueant.pem"]
55
;; Each active profile gets merged into the project map. The :dev
56
;; and :user profiles are active by default, but the latter should be
57
;; looked up in ~/.lein/profiles.clj rather than set in project.clj.
58
;; Use the with-profiles higher-order task to run a task with a
59
;; different set of active profiles.
60
;; See `lein help profiles` for a detailed explanation.
61
:profiles {:dev {:resource-paths ["dummy-data"]
62
:dependencies [[clj-stacktrace "0.2.4"]]}
63
:debug {:debug true
64
:injections [(prn (into {} (System/getProperties)))]}
65
:1.4 {:dependencies [[org.clojure/clojure "1.4.0-alpha1"]]}}
66
;; Support project-specific task aliases. These are interpreted in
67
;; the same way as command-line arguments to the lein command. If
68
;; the alias points to a vector, it uses partial application. For
69
;; example, "lein with-magic run -m hi.core" would be equivalent to
70
;; "lein assoc :magic true run -m hi.core".
71
:aliases {"launch" "run"
72
"with-magic" ["assoc" ":magic" "true"]}
73
;; Normally Leiningen runs the javac and compile tasks before
74
;; calling any eval-in-project code, but you can override this with
75
;; the :prep-tasks key to do other things like compile protocol buffers.
76
:prep-tasks ["protoc" "compile"]
77
;; Warns users of earlier versions of Leiningen.
78
:min-lein-version "2.0.0"
79
;; Paths to include on the classpath from each project in the
80
;; checkouts/ directory. (See the FAQ in the Readme for more details
81
;; about checkout dependencies.) Set this to be a vector of
82
;; functions that take the target project as argument. Defaults to
83
;; [:source-paths :compile-path :resource-paths], but you could use
84
;; the following to share code from the test suite:
85
:checkout-deps-shares [:source-paths :test-paths
86
~(fn [p] (str (:root p) "/lib/dev/*"))]
87
;; Load these namespaces on startup to pick up hooks from them.
88
:hooks [leiningen.hooks.difftest]
89
;; Predicates to determine whether to run a test or not. See tutorial.
90
:test-selectors {:default (fn [t] (not (or (:integration v) (:regression v))))
91
:integration :integration
92
:regression :regression}
93
;; These namespaces will be AOT-compiled. Needed for gen-class and
94
;; other Java interop functionality. Put a regex here to compile all
95
;; namespaces whose names match.
Jan 25, 2011
96
:aot [org.example.sample]
97
;; The -main function in this namespace will be run at launch if you
98
;; create an uberjar. Set :skip-aot metadata on this symbol to use
99
;; it for other things like the run task or shell wrappers without
100
;; bringing in AOT if you don't need an executable uberjar.
101
:main org.example.sample
102
;; Options to change the way the REPL behaves
103
:repl-options {;; Specify the string to print when prompting for input.
104
;; defaults to something like (fn [ns] (str *ns* "=> "))
105
:prompt (fn [ns] (str "your command for <" ns ">, master? " ))
106
;; Specify the ns to start the REPL in (overrides :main in
107
;; this case only)
108
:init-ns foo.bar
109
;; This expression will run when first opening a REPL, in the
110
;; namespace from :init-ns or :main if specified
111
:init (println "here we are in" *ns*)
112
;; Customize the socket the repl task listens on and
113
;; attaches to.
114
:host "0.0.0.0"
115
:port 4001
116
;; If nREPL takes too long to load it may timeout,
117
;; increase this to wait longer before timing out.
118
;; Defaults to 30000 (30 seconds)
119
:timeout 40000}
120
;; Forms to prepend to every form that is evaluated inside your project.
121
;; Allows working around the Gilardi Scenario: http://technomancy.us/143
122
:injections [(require 'clojure.pprint)]
123
;; Emit warnings on all reflection calls.
124
:warn-on-reflection true
125
;; Set this in order to only use the :repositories you list below.
126
:omit-default-repositories true
127
;; These repositories will be searched for :dependencies and
128
;; :plugins and will also be available to deploy to.
129
:repositories {"java.net" "http://download.java.net/maven/2"
130
"sonatype"
131
{:url "http://oss.sonatype.org/content/repositories/releases"
132
;; If a repository contains releases only; setting :snapshots
133
;; to false will speed up dependency checking.
134
:snapshots false
135
;; You can also set the policies for how to handle :checksum
136
;; failures to :fail, :warn, or :ignore. In :releases, :daily,
137
;; :always, and :never are supported.
138
:releases {:checksum :fail :update :always}
139
;; You can set :checksum and :update here for them
140
;; to apply to both :releases and :snapshots:
141
:update :always, :checksum :fail}
142
;; Repositories named "snapshots" and "releases" automatically
143
;; have their :snapshots and :releases disabled as appropriate.
144
;; Credentials for repositories should *not* be stored
145
;; in project.clj but in ~/.lein/profiles.clj instead:
146
;; {:auth {:repository-auth {#"http://blueant.com/archiva/"
147
;; {:username "milgrim"
148
;; :password "locative.1"}}}}
149
"snapshots" "http://blueant.com/archiva/snapshots"
150
"releases" {:url "http://blueant.com/archiva/internal"
151
;; Using :env as a value here will cause an
152
;; enironment variable to be used based on
153
;; the key; in this case LEIN_PASSWORD.
154
:username "milgrim" :password :env}}
155
;; You can set :update and :checksum policies here to have them
156
;; apply for all :repositories. Usually you will not set :update
157
;; directly but apply the "update" profile instead.
158
:update :always
159
;; the deploy task will give preference to repositories specified in
160
;; :deploy-repositories, and repos listed there will not be used for
161
;; dependency resolution.
162
:deploy-repositories {"releases" "http://blueant.com/archiva/internal/releases"
163
"snapshots" "http://blueant.com/archiva/internal/snapshots"}
164
;; Prevent Leiningen from checking the network for dependencies.
165
;; This wouldn't normally be set in project.clj; it would come from a profile.
166
:offline? true
167
;; Override the location of the local maven repository.
168
:local-repo "/home/dude/.lein/repo"
169
;; If you'd rather use a different directory structure, you can set these.
170
;; Paths that contain "inputs" are vectors, "outputs" are strings.
171
:source-paths ["src" "src/main/clojure"]
172
:java-source-paths ["src/main/java"] ; Java source is stored separately.
173
:test-paths ["test" "src/test/clojure"]
174
:resource-paths ["src/main/resource"] ; non-code files included in classpath/jar
175
:compile-path "target/classes" ; for .class files
176
:native-path "src/native" ; where to extract native dependencies
177
:target-path "target/" ; where to place the project's jar file
178
:jar-name "sample.jar" ; name of the jar produced by 'lein jar'
179
:uberjar-name "sample-standalone.jar" ; as above for uberjar
180
;; Options to pass to java compiler for java source
181
:javac-options [:destdir "classes/"]
182
;; Leave the contents of :source-paths out of jars (for AOT projects)
184
;; Files with names matching any of these patterns will be excluded from jars
185
:jar-exclusions [#"(?:^|/).svn/"]
186
;; Same thing, but for uberjars.
187
:uberjar-exclusions [#"META-INF/DUMMY.SF"]
188
;; Add arbitrary jar entries. Supports :path, :paths, :bytes, and :fn types.
189
:filespecs [{:type :path :path "config/base.clj"}
190
;; directory paths are included recursively
191
{:type :paths :paths ["config/web" "config/cli"]}
192
;; programmatically-generated content can use :bytes
193
{:type :bytes :path "project.clj"
194
;; strings or byte arrays are accepted
195
:bytes ~(slurp "project.clj")}
196
;; :fn filespecs take the project as an argument and
197
;; should return a filespec map of one of the other types.
198
{:type :fn :fn (fn [p]
199
{:type :bytes :path "git-log"
200
:bytes (:out (clojure.java.shell/sh
201
"git" "log" "-n" "1"))})}]
202
;; Set arbitrary key/value pairs for the jar's manifest.
203
:manifest {"Project-awesome-level" "super-great"
204
;; function values will be called with the project as an argument.
205
"Class-Path" ~#(clojure.string/join
206
\space
207
(leiningen.core.classpath/get-classpath %))
208
;; symbol values will be resolved to find a function to call.
209
"Grunge-level" my.plugin/calculate-grunginess}
210
;; You can set JVM-level options here.
212
;; Control the context in which your project code is evaluated.
213
;; Defaults to :subprocess, but can also be :leiningen (for plugins)
214
;; or :classloader (experimental) to avoid starting a subprocess.
215
:eval-in :leiningen
216
;; Enable bootclasspath optimization. This improves boot time but interferes
217
;; with using things like pomegranate at runtime and using Clojure 1.2.
219
;; Set parent for working with in a multi-module maven project
220
:parent [org.example/parent "0.0.1" :relative-path "../parent/pom.xml"]
221
;; Extensions here will be propagated to the pom but not used by Leiningen.
222
:extensions [[org.apache.maven.wagon/wagon-webdav "1.0-beta-2"]
223
[foo/bar-baz "1.0"]])