On Wed, 27 Apr 2011 10:45:58 -0700 (PDT)
cej38 <junkerme...@gmail.com> wrote:

> Hi,
>   I would like the simplest method to compile a few lines of clojure
> code into a jar file that I can distribute to some fellow scientists
> that don't know much (if anything) about java or clojure.  Since I am
> not creating a huge product that I will be updating often, maven and
> Lenningen seem like overkill.  The compiled jar file should contain
> the relevant clojure and clojure.contrib stuff within it, so that the
> other users don't have to worry about downloading clojure/contrib.
> 
> Also, I would rather not unpack jar files from libraries that I used,
> if possible.
> 
> Clojure's compile function is tantalizing, but then everyone would
> need to have the same versions of the libraries that I used, not just
> clojure and contrib.

This is one of the holes in the Clojure/Java infrastructure - things
that should be simple aren't. So there isn't anything simpler than a
project except the bare file manipulation commands.

To use those commands, you need to compile all your clojure files to
class files (via the clojure "compile" command), then use the jar
command to create the "uberjar" (still a .jar) file that contains all
the relevant .class files, and also the contents of the .jar files
that your program depends on.

Unlike most compiled languages, there isn't a "driver" program
available that will take a list of files on the command line and
compile them, then put the results together to what you want. Instead,
you have to rely on project manipulation tools like ant, lein or maven
to take a file describing the project and do all that for you.

While I agree with you that things like lein are overkill for this
kind of thing, they're still probably the simplest solution you're
going to find. It's probably easier to figure out how to use lein to
build your uberjar than to figure out how to get jar to create the
same thing.

Sadly, I don't see this situation changing. Java people seem to think
this is normal, and suggest that "Clojure isn't the right language"
(what they mean is that Java isn't the right environment) when it gets
pointed out. So even if someone wrote a "jc" command that knew how to
compile Java, Clojure, Scala, Groovy, JRuby, Jython, etc. and which
jar files to add for each of them, I suspect it wouldn't get any mind
share in those communities because there isn't a lot of interest in
tools to make simple things simple.

      <mike
-- 
Mike Meyer <m...@mired.org>             http://www.mired.org/consulting.html
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to