Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you distribute a Clojure program to non-programmers?

Tags:

clojure

I'm new to Clojure but I'm learning it. I'd like to know the best way to package and distribute a Clojure program to end users who aren't necessarily programmers. I know in Ruby you can just tell users to download the program with gem install [program name] and then run the command that runs the program. What's the equivalent for Clojure programs?

like image 283
dan Avatar asked Feb 03 '11 16:02

dan


People also ask

How do I run a program in Clojure?

Create a new Clojure project with Leiningen. Build the project to create an executable JAR file. Execute the JAR file. Execute code in a Clojure REPL.

What is Clojure Leiningen?

Leiningen is a modern build system for our Clojure projects. It's also written and configured entirely in Clojure. It works similarly to Maven, giving us a declarative configuration that describes our project, without needing to configure exact steps to be executed.


3 Answers

I you use Leiningen it has an uberjar command to make self contained executable jar files, which your users can just double click. See: http://zef.me/2470/building-clojure-projects-with-leiningen

like image 97
pauldoo Avatar answered Dec 04 '22 23:12

pauldoo


Clojars is great if you're distributing a library, but I'm not sure if that's the best option for end users.

If you're already using Maven, I believe the best option is to create a uberjar containing all required classes. If you want to make it even more end user friendly, you can then create an installer from this jar using something like IzPack. Just remember that Clojure programs are Java programs, so all distribution options for Java are valid for Clojure as well.

like image 25
pazustep Avatar answered Dec 04 '22 22:12

pazustep


lein uberjar works great for small mostly-Clojure apps, but it doesn't scale when using many Java libraries, including necessary licenses, and other such things. If you use the Maven Clojure plugin, you could take advantage of the vast and terrifying Maven assembly plugin to build and final structure you might conceivably need.

Or you could write a Leiningen plugin to do something similar. I'm not sure if such a thing exists.

like image 32
Alex Miller Avatar answered Dec 04 '22 23:12

Alex Miller