Using this script
(ns build
(:require
[clojure.tools.build.api :as b]
[org.corfield.build :as bb]))
(defn -main
"Builds an uberjar"
[& _]
(let [class-dir "target/classes"
uber-file "target/ic-standalone.jar"
opts {:class-dir class-dir
:compile-opts {:direct-linking false}
:main 'company.web.server.main
:uber-file uber-file
:exclude ["license(.)*"]}]
(b/delete {:path class-dir})
(bb/uber opts)
(println "Uberjar is built.")
opts))
I get an uberjar but one of the namespaces that is loaded dynamically isn’t therebb/uber will compile things in your :src-dirs
@emccue One of the namespaces in your own codebase? Is it under src or some other folder? bb/uber does
(println "Copying" (str (str/join ", " src+dirs) "..."))
(b/copy-dir {:src-dirs src+dirs
:target-dir class-dir})it is in shared-src
:paths ["src"
"ui-src"
"shared-src"
"resources"]
I think you need to set :src-dirs then to include it in compilation
Ah, OK, you need to tell the build about that then -- by default it just uses src.
okay
is there a way to pull it out of the deps edn’s basis or is this just a place i need to specify
bb/uber assumes src + resources for copying but you can override :src-dirs and :resource-dirs for bb/uber.
bb/uber is just a shorthand for what's in the tools.build Guide:
(defn uber [_]
(clean nil)
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis basis}))If you want additional files copied into the classes folder, you need to tell the build about it.
Add it to your opts hash map in your -main (kind of weird to use -main in build.clj BTW -- the expected usage is clojure -T:build <task>).