This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-03
Channels
- # announcements (5)
- # babashka (7)
- # beginners (119)
- # biff (4)
- # cider (7)
- # clj-kondo (26)
- # cljfx (3)
- # cljs-dev (2)
- # clojure (28)
- # clojure-austin (18)
- # clojure-europe (9)
- # clojure-france (6)
- # clojure-norway (4)
- # clojure-uk (3)
- # clojurescript (6)
- # community-development (1)
- # core-async (4)
- # cursive (9)
- # data-science (12)
- # datomic (13)
- # duct (18)
- # emacs (15)
- # etaoin (5)
- # events (13)
- # honeysql (46)
- # hyperfiddle (9)
- # jackdaw (5)
- # jobs (13)
- # keechma (4)
- # lsp (37)
- # malli (32)
- # nbb (14)
- # off-topic (10)
- # other-languages (2)
- # polylith (4)
- # programming-beginners (3)
- # reagent (27)
- # reitit (1)
- # shadow-cljs (32)
- # sql (11)
- # tools-build (5)
- # tools-deps (3)
- # vim (14)
- # xtdb (11)
Im trying to migrate a project from uberdeps/uberdeps
to tools.build
and was wondering how to deal with resources, like .edn
files when building an uber-jar. My build.clj
file contains something like this:
(def basis (b/create-basis {:project "deps.edn"
:aliases [:shared
:component_a
:component_b
:service]}))
(def class-dir "target/classes")
(defn uber [_]
;(b/copy-dir {:src-dirs [ ... resource-dirs-from-aliases ...]
; :target-dir class-dir})
(b/compile-clj {:basis basis
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file "target/service.jar"
:basis basis
:main 'service.main}))
but without the copy-dir
explicitly listing the resource
dirs that are declared as :extra-src
in the aliases, they will not be part of jar file. I can collect these dirs from the basis
but maybe there is a more straightforward way or am I missing something here?my current solution is:
(b/copy-dir {:src-dirs (->> basis
:classpath-args
:extra-paths
(filter #(clojure.string/ends-with? % "/resources")))
:target-dir class-dir})
Typically you want your resource dirs in your :paths (as they are part of the classpath), and then you will get them from the copy-dir