Last active
August 29, 2015 14:10
-
-
Save bsima/88969126962803a6500f to your computer and use it in GitHub Desktop.
Sometimes you want to use boot as a scripting platform on top of Leinengen. Paste this code at the top of your build.boot file. It reads in the project.clj file and stores it as a map named "project" which you can then use with `set-env!` to setup your environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(set-env! :dependencies '[[leiningen-core "2.5.0"]]) | |
(use 'leiningen.core.project) | |
(eval (read-string (slurp "project.clj"))) | |
(set-env! | |
:source-paths (:source-paths project) | |
:resource-paths (:resource-paths project) | |
:dependencies (:dependencies project)) | |
;; Line 9 will replace the dependencies vector from line 1. If you want to merge them, | |
;; you might need to do #(into % (:dependencies project)) or something like that. |
I made this into a task and added it to the Boot wiki: https://github.com/boot-clj/boot/wiki/Using-Boot-in-a-Leiningen-Project
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above approach does load quite a few dependencies that conflict with other libraries being loaded.
This snipped has no outside dependencies and does pretty much the same thing (assuming you have a rather simple project.clj (It is not very robust)