leiningen can create an 'uberjar' for you with all your dependencies....
lein uberjar
will create a jar for you in the target subdirectory. The jar will contain all the dependencies listed in your project.clj
, so you don't need to worry about constructing a complex classpath to invoke your code.
You can reference this uberjar as a single entry in your java classpath in the normal way or, specify a main-class in the project.clj
invoke it as an executable jar.
e.g. a project.clj
like this:
(defproject clj-scratch "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.4.0"]
:main clj-scratch.core)
will invoke the -main
function in clj-scratch.core namespace
if you run:
java -jar target/clj-scratch-1.0.0-SNAPSHOT-standalone.jar
lein run
needs theproject.clj
created. – Frontolysis