Saturday, September 17, 2011

Leiningen and Eclipse

I'm now fairly comfortable with leiningen, though I still feel a frisson of anxiety whenever I run it. I know that Maven is lurking there somewhere, and my experiences with Maven have not been happy.

I'm also a bit leery of letting lein download and install arbitrary software from external sources. I'll need to set up a local repository, which will mean a closer brush with Maven that I've had before.

It's annoying, but seems unavoidable. Clojure libraries and tutorials generally assume that you're using leiningen.

At least the lein/Eclipse combo makes it simple to create and populate an Eclipse Clojure project.

Here's what you do:

  1. In the directory in which  you want to create your project, run lein new
  2. cd to the newly-created directory
  3. open project.clj in your text editor of choice
  4. add :dev-dependencies [[lein-eclipse "1.0.0"]]
  5. save the file
  6. run lein deps
  7. run lein eclipse
  8. import your newly-created project into eclipse
At the end of stage 4, your project.clj file should look like this
(defproject hadoop-spike "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.2.1"]]
  :dev-dependencies [[lein-eclipse "1.0.0"]])

WabbitMQ runs too

Off to a good start this morning;I set up a Clojure spike using WabbitMQ and got a simple test running in a few minutes. Now I can link up my Python and Clojure components. Eeeeeeeexcelent.

Thursday, September 15, 2011

Run, RabbitMQ, run Rabbit, run, run, run

I'm about to do some more work on Sknoman (a personal knowledge management application) and need to link together several disparate subsystems. Some are written in Python, but I'm developing one in clojure.

Nat Pryce speaks highly of RabbitMQ, so I decided to give it a try.

For reasons too boring to explain, I'm developing on a Ubuntu Lucid virtual machine. Lucid is almost as old as I am, so the packaged version of RabbitMQ is seriously out-of-date.

Once I'd installed an up-to-date version from the RabbitMQ Debian repo, I had the RabbitMQ Python send/receive example running in about five minutes. While that's hardly an exhaustive test, it's very reassuring.

I'll be trying a Clojure client next, but I'm hoping this is going to be painless.