Fork me on GitHub
#tools-build
<
2024-04-14
>
mike_ananev14:04:18

Hi! I want to exclude sources of my application (*.clj) from uberjar. To acheive this I excluded src folder on step b/copy-dir . Is it correct way? This is my uber function from build.clj file.

(defn uber
  [_]
  (println "Project:")
  (clojure.pprint/pprint project-env)
  (b/copy-dir {:src-dirs   ["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
           :main      main-ns}))

jumar04:04:52

I'm also wondering about this. What about the sources in dependencies? Is it maybe better to :exclude ?

Alex Miller (Clojure team)12:04:10

Most libs are distributed source-only so you can’t exclude that

Alex Miller (Clojure team)12:04:47

Unless you ensure you have aot compiled every namespace you might need

jumar06:04:43

I’m sure :) And I also want to only exclude our org namespaces not 3rd party The exclude option seems to do the job afaict