Call shell from within Leiningen.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src/leiningen Support recursive parameter expansion, closes #21 Nov 28, 2015


A Leiningen plugin for calling shell commands. lein-shell is an active, stable project.


Put [lein-shell "0.5.0"] into the :plugins vector of your :user profile inside ~/.lein/profiles.clj if you want to use lein shell on a per user basis (this doesn't really make much sense, but you're allowed to if you want to!).

To explicitly say that this project needs lein-shell to be built, put [lein-shell "0.5.0"] into the :plugins vector of your project.clj. If you have no :plugins vector in your project.clj, it should look like this:

(defproject your-project-here "version"
 :plugins [[lein-shell "0.5.0"]]


It is very straightforward to use lein-shell: lein-shell will call the shell command with eventual parameters you include. For instance, if you want your favourite cow to say hello to you from Leiningen, the following will be printed within your shell:

$ lein shell cowsay 'Hello from Leiningen!'
< Hello from Leiningen! >
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Now, this may look rather useless as you can just omit lein shell and get the exact same result in less time. However, it may be of value if you're using make or ANTLR to generate files for you, needed by your Clojure project. For example, to automatically call make before running tasks, add this to your project.clj map:

:prep-tasks [["shell" "make"] "javac" "compile"]

If the command exits with a nonzero exit code, shell will (attempt to) exit Leiningen with the same exit code. This functionality can be overridden if desired, and many other settings can be modified as well.


For more information, have a look at the documentation. It contains a lot of examples, some which hopefully are useful to you.


Copyright © 2013-2015 Jean Niklas L'orange and contributors.

Distributed under the Eclipse Public License, the same as Clojure.