On Sat, Apr 11, 2009 at 3:49 PM, Richard Lyman <richard.ly...@gmail.com> wrote:
> http://www.lithinos.com/Compiling-Clojure-applications-using-Ant.html
>
> What do you guys think?
>
> -Rich

It's a bit simpler to use clojure.lang.Compile as a main class.
Here's the relevant bit from one of my build.xmls:

  <target name="compile" depends="clean,init">
    <java classname="clojure.lang.Compile"
              classpathref="project.classpath"
              fork="true"
              failonerror="true">
      <classpath path="${src.dir}" />
      <sysproperty key="clojure.compile.path" value="${classes.dir}" />
      <arg value="clj-record.boot" />
    </java>
  </target>

http://github.com/duelinmarkers/clj-record/blob/c8235e7d854c0049a785d7773665cb6c62efb024/build.xml#L30

I strongly recommend failonerror="true" so that your build will abort
if compilation fails. (If you stick with the clojure.main -e
"(compile..." approach I think you'll find clojure.main doesn't exit
with an error code, so it won't work. There's another recent thread
about that and I'm planning to open an issue and submit a patch for it
when I have a chance. clojure.lang.Compile does exit with an error
when compilation fails, so the above will fail a build appropriately.)

Also, I'd recommend being clearer in describing the "app" variable. It
will need to be a Clojure namespace that when loaded will (one way or
another) load in all of your Clojure code. If someone is building a
library, it's relatively likely there is no such namespace.

-hume.
-- 
http://elhumidor.blogspot.com/

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