2
votes

I am reading Doug Hoyte's Let Over Lambda. This book is mostly about writing advanced Common Lisp macros.

If I start writing many Clojure macros, I would like to keep them in some kind of library, perhaps a source code JAR file. At the present time, I keep these things a "Snippets" program and copy/paste them into code as needed. If they could be kept in a JAR, then a change to a macro would just require a re-compilation of any projects that used it.

Is there some way to package them into a source JAR that can then be included in a Clojure Maven build so that they get compiled with the rest of the code and end up in the ultimate project executable JAR file?

I know that the idiomatic way to develop Clojure code is using the REPL, but I frequently write executable JAR utilities that I send to in-house customers who know nothing about Clojure.

1

1 Answers

3
votes

My setup is that I have a personal library for these kind of functions that I keep in a separate project (I use Eclipse with the Clojure Counterclockwise plugin).

During development, I just set my current project to use my standard library as a dependency. This seems to work fine whether you use the REPL or launch the app as a standalone program.

I then use Maven (m2eclipse) to build this into a jar file artifact, which can be distributed as required in the normal way.