Reputation: 13686
Like many JVM languages, packaging and starting a JVM application can be done in a multitude of ways. What are some solid ways of packaging large clojure projects having lots of both clojure and Java dependencies, for deploying and starting them in production-like environments?
Upvotes: 2
Views: 179
Reputation: 4748
With leiningen, you can simply package through:
lein uberjar
This will package all the dependencies and your code into one jar that you can then run via:
java -jar uberjar.jar
For that to work however, you have to specify a :main
namespace in your project.clj
, which will trigger AOT, the latter considered undesirable for other causes such as for being able to cleanly use clojure.tools.namespace
over your project. So to avoid AOT, you can skip specifying a :main
namespace in your project.clj
, and simply run with the slightly more verbose command:
java -jar uberjar.jar clojure.main -m your.main.namespace
Upvotes: 4