-
-
Notifications
You must be signed in to change notification settings - Fork 180
Using Boot in a Leiningen Project
Jim Riordan edited this page Mar 15, 2017
·
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.
(def boot-version
(get (boot.App/config) "BOOT_VERSION" "2.7.1"))
(deftask from-lein
"Use project.clj as source of truth as far as possible"
[]
(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)}))]
(merge-env! :repositories (:repositories lein-proj))
(set-env!
:certificates (:certificates lein-proj)
:source-paths (or (into #{} (:source-paths lein-proj)) #{"src"})
:resource-paths (or (into #{} (:resource-paths lein-proj)) #{"resources"})
:dependencies (into (:dependencies lein-proj)
`[[boot/core ~boot-version :scope "provided"]
[adzerk/bootlaces "0.1.13" :scope "test"]]))
(require '[adzerk.bootlaces :refer :all])
((resolve 'bootlaces!) (:version lein-proj))
(task-options!
repl (:repl-options lein-proj {})
aot (let [aot (:aot lein-proj)
all? (or (nil? aot) (= :all aot))
ns (when-not all? (set aot))]
{:namespace ns :all all?})
jar {:main (:main lein-proj)}
pom {:project (symbol (:project lein-proj))
:version (:version lein-proj)
:description (:description lein-proj)
:url (:url lein-proj)
:scm (:scm lein-proj)
:license (get lein-proj :license {"EPL" "http://www.eclipse.org/legal/epl-v10.html"})}))
identity)
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util