Uberjar from the shell for tools.deps

I’ve migrated a few projects from lein to tools.deps and explored different approaches to building uberjars. For the time being, I am using uberdeps.

One issue I have was that even though the clojure CLI already generates a nice classpath for you and the ability to merge in extra paths and dependencies, existing packaging tools require you to use a different syntax to configure the same options. This is because the dependency on the tool itself impacts the clojure-generated classpath and will end up impacting the output.

I was interested in whether we could create an uberjar using just the clojure cli and java tooling, without depending on external packages, and have managed to come up with a few scripts that I’ve put in a gist:

gist - Create an uberjar from a clojure classpath

Ultimately, it depends on the clojure generated classpath directly, optionally adds maven pom.xml details from your project into the META-INF, and uses the jar tool with its various options to create a runnable jar with a manifest.

Have a look, try it out, and mix and match it into your build scripts if you like.


Take a look at depstar – it packages up files from the classpath being used and simply excludes itself from those dependencies, so you use exactly the aliases you want/need for the environment you want the JAR file to be built in.


Not sure it belongs here, but you could actually not create an uberjar and distribuite just a single script file that does it all with CLJ: e.g. https://gist.github.com/ericnormand/6bb4562c4bc578ef223182e3bb1e72c5

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.