views:

336

answers:

1

How do I install a leiningen plugin?

For example, leiningen-run?

I see this thing called "clojars.org", and how to "push" to it, but I don't see anything about "pulling" from it.

+6  A: 

If a plugin's available at Clojars, like lein run is, just add it to your project's :dev-dependencies in project.clj, then say lein deps in your project's directory to have Leiningen pull in all dependencies. An annotated excerpt from lein run's docs:

(defproject island-wari "0.1"
  :description "Web application for playing the Island Wari game."
  :main wari
  :dependencies     [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
                     [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]
                     [org.clojars.liebke/compojure "0.3.1-master"]]
  :dev-dependencies [[org.clojure/swank-clojure "1.0"]
                     [leiningen-run "0.2"]]) ; <--- this bit makes it possible
                                             ;      to use lein run

Having done the above, you should be able to say lein run in your project's directory to run your app.

Update: Should you want to write your own plugins for Leiningen, check out this tutorial on nakkaya.com. Even if you're not planning on writing lein plugins, still check out that blog, it absolutely positively rocks.

Michał Marczyk
It was the "lein deps" step that I was neglecting all along. Thank you!
scrapdog