How to install a leiningen plugin?

后端 未结 2 798
南方客
南方客 2021-02-07 05:13

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 ab

2条回答
  •  误落风尘
    2021-02-07 05:41

    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.

提交回复
热议问题