Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure deployment?

Tags:

clojure

What is the easiest way to make a clojure app into an executable like http://rawr.rubyforge.org/ does for ruby? (exe and app files too)

like image 880
VectorBEAR Avatar asked May 26 '10 17:05

VectorBEAR


2 Answers

Use leiningen and build an uberjar(standalone jar that contains all dependencies) from the project.

As Alex Ott mentions in the comment to my answer, another may to build your app is to use Maven + Clojure plugin for maven. Afterward you may use a tool such as IzPack to generate an installer or an executable wrapper for your jar artifact. You may use IzPack with leiningen as well of course - it doesn't care about the build system at all - only about the resulting files :-)

After you have the uberjar there are many option to wrap it in a native executable launcher for windows - izpack2exe, jsmooth, jar2exe, executor, etc...

like image 175
Bozhidar Batsov Avatar answered Sep 27 '22 18:09

Bozhidar Batsov


To expand on Bozhidar's answer leiningen makes it super easy to generate a jar that packages your app and its dependencies. Just run lein uberjar from the terminal when you are inside your project directory and it will create a file project-name-0.1.0-standalone.jar that can be run with java -jar where "project-name" is the name of your project. You want to make sure that is your project.clj you set :main to your file that has a -main function. Also in your main file you want to put (:gen-class) inside your namespace declaration like so:

    (ns project-name.main
      (: require ...)
      (:gen-class))
like image 21
Sean Geoffrey Pietz Avatar answered Sep 27 '22 19:09

Sean Geoffrey Pietz