tools-build 2023-08-30

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.

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

👍🏽 1

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

Alex Miller (Clojure team) 2023-08-30T12:36:57.644889Z

Yep, that’s what that is for

1