Posts Tagged ‘leiningen’

`lein run` plugin

Friday, May 7th, 2010

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:

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.)