;; As of September 2016, using the version of boot-clj that I got by following the Nix install instructions, | |
;; here is how I built a clojure "hello world" as a uberjar that you can run with `java -jar`. I do | |
;; not claim it is the right way, merely that it worked for me. This file is build.boot | |
(set-env! | |
:resource-paths #{"src"} ; may be optional? | |
:source-paths #{"src"} ; my code is in src/myapp/core.clj | |
:dependencies '[[org.clojure/clojure "1.8.0"]]) ; not sure I'm actually using this, boot may be overriding it | |
(task-options! | |
; these are default arguments that are merged in whenever their respective tasks are called | |
pom {:project 'myapp ; this is java magic and i don't know why I'm doing it | |
:version "0.1.0"} | |
jar {:main 'myapp.core} | |
target {:dir #{"target/"}}) | |
; these are the tasks which I want to run | |
(deftask build [] | |
(comp | |
(aot :namespace #{'myapp.core}) ; I *think* this is needed to get a .class file for this ns into the jar | |
(pom) | |
(uber) ; unpacks all the dependencies into the output fileset | |
(jar) ; the file this creates is called "project.jar" no matter what the project was called | |
(sift :include #{#"project.jar$"}) ; remove all the other files in the output fileset | |
;; requirement for the following step seems to have been added quite recently as I don't see it mentioned | |
;; in many web examples. without it you will not get the target/ directory and will never be able to find | |
;; the generated example | |
(target) ; save the output fileset | |
(install) ; I thnk this also puts stuff in your local maven (may be able to skip this) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
telent commentedSep 9, 2016
Impressions of boot as a new user:
(target)
:gen-class
but I always forget that with leiningen too, so not boot's faultTo get the example to work, run
I have not (knowingly) used any plugins or middlewares or any other libraries here.