tools-build

enn 2025-10-14T13:00:34.727079Z

I want to build an uberjar for use with DATOMIC_EXT_CLASSPATH , to be loaded by the Datomic transactor. I want it to be an uberjar because there are some dependencies I want to include. I don't want to include Clojure and the Datomic peer library in the uberjar, because they will already be present on the transactor's classpath. But I need Clojure and Datomic present at build time. What's the best way to achieve this with tools.build?

Alex Miller (Clojure team) 2025-10-14T14:22:05.483279Z

this is a little challenging depending on the transitive dependency set of both Datomic peers and your code and whether they overlap

Alex Miller (Clojure team) 2025-10-14T14:22:31.397509Z

do they?

enn 2025-10-14T14:32:58.531889Z

Looking at the deps tree, it appears that they do not.

Alex Miller (Clojure team) 2025-10-14T16:02:02.854849Z

The Datomic stuff is pretty easily handled if you: 1. create a basis with all deps and AOT compile to a classes directory 2. uber with :class-dir classes and :exclude ["com.datomic.*"] I think (maybe there are other patterns needed)

Alex Miller (Clojure team) 2025-10-14T16:02:45.330289Z

might be easier to make a second basis and pull the datomic libs from the :deps instead of the :exclude, not sure

Alex Miller (Clojure team) 2025-10-14T16:03:02.977709Z

there is not an easy way to omit Clojure itself from the uber jar though

Alex Miller (Clojure team) 2025-10-14T16:09:52.602419Z

I am misremembering how :exclude works, it's not lib-based, it's path-based, so you could use it to remove both datomic and clojure stuff like :exclude ["com/datomic/.*" "org/clojure/.*"]

enn 2025-10-14T17:34:11.236589Z

Thanks, Alex. This would still require step 1 above, right? ("create a basis with all deps and AOT compile to a classes directory*")*

Alex Miller (Clojure team) 2025-10-14T17:42:41.701269Z

yep

1