I recently had to figure out for a Clojure application how to download all dependency JAR files, for use in a Docker container.
When creating an uberjar, depstar re-downloaded all the external dependencies from Maven central, even though in an earlier Docker build step, I ran clj -Spath
to pre-download them (presumably cached into the .m2 directory). In the past, I've used lein deps
to do something similiar.
I'm grateful for Sean Corfield helping out (again!!): In short, use clj -P
(short for "prepare") to download dependencies. Note the "A:depstar" option, which ensures that the depstar dependencies are downloaded, too.
Here's what it looks like in a Dockerfile:
# to pre-download dependencies, only done if deps.edn changes