开发者

Clojure deployment?

What is the easiest way to mak开发者_开发百科e a clojure app into an executable like http://rawr.rubyforge.org/ does for ruby? (exe and app files too)


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...


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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜