Creating an Uberjar

Our docs are on GitHub, and all contributions are welcome. Suggest an edit or report a problem.

OneJar

Edge provides a script for running pack to build an uberjar. To use it, you can simply run the below from your project sub-directory (the same folder as your deps.edn).

$ ../bin/onejar -A:prod --args '-m edge.main' project.jar

The -A:prod indicates an alias you would like to have its :extra-deps and :paths included in your resulting jar. --args are default arguments to your jar, in this case we are specifying that the application should run edge.main, part of the edge production modules.

Capsule

Build a capsule uberjar using this command:

$ ../bin/capsule -m edge.main -e 'target/prod' -A:prod project.jar

If you are using clojurescript in your project make sure you run this command first:

$ clojure -A:build:build/once

It will build the clojurescript files and put them in the correct folder to be included in the uberjar.

Running the jar

You can run the produced jar in production quite easily:

$ java -Xmx1G -jar project.jar

We recommend that you specify the memory usage of your JVM, as the default on Java 6+ is usually insufficient for hosts run only this JVM process. A rule of thumb is to use 2/3rds of the memory of your host.

Last updated 2019-08-20 09:25:18 +0100