Clojure 源代码库
我正在阅读 Doug Hoyte 的 Let Over Lambda。本书主要是关于编写高级 Common Lisp 宏。
如果我开始编写许多 Clojure 宏,我想将它们保存在某种库中,也许是源代码 JAR 文件。目前,我将这些东西保留为“片段”程序,并根据需要将它们复制/粘贴到代码中。如果它们可以保存在 JAR 中,那么对宏的更改只需要重新编译任何使用它的项目。
是否有某种方法将它们打包到源 JAR 中,然后将其包含在 Clojure Maven 构建中,以便它们与其余代码一起编译并最终形成最终的项目可执行 JAR 文件?
我知道开发 Clojure 代码的惯用方法是使用 REPL,但我经常编写可执行的 JAR 实用程序,并将其发送给对 Clojure 一无所知的内部客户。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的设置是,我有一个用于此类功能的个人库,并将其保存在一个单独的项目中(我将 Eclipse 与 Clojure 逆时针插件)。
在开发过程中,我只是将当前项目设置为使用我的标准库作为依赖项。无论您使用 REPL 还是将应用程序作为独立程序启动,这似乎都能正常工作。
然后,我使用 Maven (m2eclipse) 将其构建为 jar 文件工件,该工件可以根据需要进行分发正常方式。
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.