Fork me on GitHub
#tools-build
<
2023-08-30
>
bg07:08:24

Is it possible to only compile/include clojure files that are actually required by my :main entry point? I have a monorepo with a bunch of services. I would like to build an uberjar for one service and include only the namespaces/packages used by that service. Right now when I use compile-clj it tries to compile all files in the project and thus generates a large jar file. It’d be great if there was a way to only compile the namespaces that are required by the main class.

dominicm11:08:25

Can you point compile-clj at a particular namespace? If you point it at your main that should aot it and any dependencies.

2
bg12:08:40

OK, I wasn't aware of the :ns-compile keyword. Will try that out. Thanks!

Alex Miller (Clojure team)12:08:57

Yep, that’s what that is for

clojure-spin 2