Run time requires (within task definitions) - boot-clj/boot GitHub Wiki
Requiring things at runtime
You may want your task itself to require namespaces, e.g. so that these namespaces don't need to be required globally in build.boot
and affect startup time unnecessarily.
However a simple (require '[my-ns.tasks :refer [some-task]])
within deftask
will not work, because when Clojure evaluates the file, all symbols in the code will be resolved and this isn't possible if you're doing the require
at runtime.
One fix would be to resolve the symbols manually:
(deftask supertask []
(require 'my-ns.tasks)
(let [some-task (resolve 'my-ns.tasks/some-task)]
(comp
(some-task)
;; ... other tasks in your supertask pipeline ...
)))