Skip to content

Instantly share code, notes, and snippets.

@alandipert
Last active April 30, 2018 17:22
Show Gist options
  • Save alandipert/3d53a625d95eb8edd30f31603008d851 to your computer and use it in GitHub Desktop.
Save alandipert/3d53a625d95eb8edd30f31603008d851 to your computer and use it in GitHub Desktop.
Example of producing multiple jars with boot
(set-env! :source-paths #{"src"})
(def +filesets+ (atom ()))
(deftask push-fs []
(fn [next]
(fn [fs]
(swap! +filesets+ conj fs)
(next fs))))
(deftask pop-fs []
(fn [next]
(fn [fs]
(if-let [prev (peek @+filesets+)]
(do (swap! +filesets+ pop)
(next prev))
(next fs)))))
(deftask build []
(comp (javac)
(uber)
(push-fs)
(jar :file "main1.jar" :main 'com.example.multijar.Main1)
(sift :include [#"^main1.jar$"])
(target)
(pop-fs)
(sift :to-resource [#".*"])
(jar :file "main2.jar" :main 'com.example.multijar.Main2)
(sift :include [#"^main2.jar$"])
(target :no-clean true)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment