`lein run` plugin

Did I ever mention that leiningen, the Clojure build tool, is awesome? Anything that spares a programmer in the Java world from the hell that is XML config files (I’m looking at you, ant and maven, the gatekeepers of hell) will find itself being declared as much. To top it off, leiningen (lein, for short) uses Maven under the hood, thus utilizing a lot of the existing infrastructure (repositories, dependency trees etc.)

Custom “tasks” in leiningen are simple Clojure functions. Oh the joy! I’ve written several custom tasks for several different projects over the last couple of months. But the one I wrote most recently — lein run — is the task that has the most utility outside of those projects. So I created a plugin out of it: http://github.com/sids/lein-run/.

From the README:

A leiningen plugin to call a function in a new process or run a .clj file.

lein-run is extremely useful when you want to launch long-running Clojure process from the command line. For example, it can be used to start a server (a web server like Compojure) or to start a process that will run in an infinite loop (a process waiting for messages from a message queue, a twitter client etc.)

Tags: ,

6 Responses to “`lein run` plugin”

  1. Wilkes Joiner says:

    I’ve been putting off writing something like this for a while. I can’t wait to try it out. Thanks!

  2. K says:

    Awesome! No need for shell scripts anymore.

    However, are you sure you add the src directory in the classpath, because launching lein run on one of my test file fails (clojure depencies are not resolved)

  3. sids says:

    K,

    Can you tell me how you are calling lein run? Passing the file path to it?

  4. sids says:

    K,

    I’ve pushed an update to the 1.0.0-SNAPSHOT. Can you try that and let me know if the problem persists?

    Thanks.

  5. K says:

    It works fine now, thanks a lot.

  6. [...] This post was mentioned on Twitter by Javier Neira. Javier Neira said: `lein run` plugin – @ infinity, plus 1 http://bit.ly/aM731b [...]