I'm developing some polyglot Java + Clojure code using the REPL most of the time (in Eclipse with CounterClockwise and Maven). In this context, it's fine to just load the source in the REPL and start interacting with the code.
However, I will ultimately want to be able to distribute and deploy the code in .jar files or similar so that it can be run as a standalone application. In this context, the code needs to be executable as a Java application with the appropriate main(...) function. And I'd like it all to build cleanly from the Maven pom.xml file.
So far I have got code working so that I have a -main function that doesn't get called when I use Clojure at the REPL, but should get called when packaged/deployed as a jar. This seems to work, but I'm not sure if this represents the best approach.
Ideally I'd like everything to work smoothly in both:
- The Counterclockwise REPL
- A standard Maven build process which results in a fully packaged / deployed jar file
What are the best practices for setting up a Clojure code base so that it can easily be used both at the REPL and built a standalone application?