Managing project builds does not have to be an endless fight with XML. Using Leiningen for Clojure projects allows you to define the project in Clojure as well.
15. Leiningen
… more fun than Maven
… easy way to kick-start your Clojure
addiction
16. Installing Leiningen
Download the Leiningen 2 install script from
leiningen.org
Move the lein file to an executable location, eg.
~/bin
Make the install script executable and run the
install
chmod u+x ~/bin/lein
17. All the usual tasks,
and then some
lein new Create a new clojure project
lein deps Download all dependencies
lein run Run your application
lein jar Deploy your app as a jar
lein uberjar Deploy your app & clojure
libraries
lein repl Start the interactive shell (repl)
lein jack-in Start repl server and connect (in
Emacs)
18. Fire up the REPL
REPL: read, evaluate, print loop – dynamic
lein repl environment for Clojure and other lisps
21. REPL driven development
Develop functions and data structures on the fly
REPL: read, evaluate, print loop – dynamic environment for Clojure and other lisps
22. Loading code into the REPL
Develop functions and data structures on the fly
REPL: read, evaluate, print loop – dynamic environment for Clojure and other lisps
23. Create a new project
lein new my-project
cd my-project
lein deps
Lein deps will check your project.clj configuration file and
download any libraries (jar files) that are required by the project
25. Create a new project
lein new my-project
cd my-project
lein deps
Lein deps will check your project.clj configuration file and
download any libraries (jar files) that are required by the project
26. Version your project with Git
cd my-project
git init
Create a repo on github & add it to your project
git remote add origin
git@github.com/account/project.git
git push -u origin master
You may want to edit your .git-ignore file also
28. project.clj - project definition
Lein deps will check this project.clj configuration file and
download any libraries (jar files) that are required by the project
34. Fire up the REPL in Emacs
M – x
clojure-
jack-in
M – x represents the keyboard combination of the meta key followed by x.
Then the command clojure-jack-in is entered.
35. Define your own Global short-cut
Open your .emacs.d/init.el file and add:
(global-set-key
(kbd "C-c C-j") 'clojure-jack-
in)
In Emacs, start the REPL with
C – c C – j