Skip to content

Using Boot in a Leiningen Project

Martin Klepsch edited this page Jun 19, 2015 · 8 revisions

The from-lein task below will setup basic environment parameters taken from a project.clj for Boot. This makes it possible to run things like:

  • boot from-lein watch build-jar
  • boot from-lein build-jar, etc.

If you want to override settings make sure you do so after calling the from-lein task.

(deftask from-lein []
  (let [lein-proj (let [l (-> "project.clj" slurp read-string)]
                    (merge (->> l (drop 3) (partition 2) (map vec) (into {}))
                           {:project (second l)
                            :version (nth l 2)}))]
    (set-env!
     :source-paths   (or (:source-paths lein-proj) #{"src"})
     :resource-paths (or (:resource-paths lein-proj) #{})
     :dependencies   (conj (:dependencies lein-proj)
                           '[adzerk/bootlaces "0.1.11" :scope "test"]))

    (require '[adzerk.bootlaces :refer [bootlaces! build-jar push-release]])

    ((resolve 'bootlaces!) (:version lein-proj))

    (task-options!
     pom  {:project     (symbol (:project lein-proj))
           :version     (:version lein-proj)
           :description (:description lein-proj)
           :url         (:url lein-proj)
           :scm         {:url "https://github.com/martinklepsch/boot-gzip"}
           :license     {"EPL" "http://www.eclipse.org/legal/epl-v10.html"}})
    identity))
Clone this wiki locally