Fork me on GitHub
#tools-build
<
2021-09-29
>
Eddie15:09:52

Does uber prune deps that aren’t used? (Maybe the term is “tree shaking”?) I am trying to set the uberjar main to a namespace in a :local/root dep that is never called called and getting a Error: Failed to load class ... When a require the namespace in an arbitrary source file and rebuild the uberjar, the error is no longer raised.

Alex Miller (Clojure team)15:09:23

no pruning, should use all deps

Alex Miller (Clojure team)15:09:46

are you compiling? if so, you might need to specify that it should be compiled if it's not in your src dir

Eddie15:09:09

Ah ok. I am compiling. That is probably the issue.

Alex Miller (Clojure team)15:09:26

by default compile-clj will compile all the namespaces in your project srcs

Alex Miller (Clojure team)15:09:39

but it doesn't know about the local dep ones

Eddie15:09:08

So maybe the way to go in this case is to inspect the basis to get the path to the dep(s) and call compile-clj on each? Does that sound sane?

Alex Miller (Clojure team)16:09:32

compile-clj can be given a set of namespaces to compile

Alex Miller (Clojure team)16:09:45

I think maybe I would call it twice - once the way you are

Alex Miller (Clojure team)16:09:04

and again just to specify any additional specific namespaces to compile

Eddie16:09:08

Gotcha. Thanks!