如何组织、测试、记录和打包 Clojure 项目
我一直在学习一些 Clojure,目前有一个 .clj
文件,我在文本编辑器中编辑该文件并在命令行上执行该文件。
我在哪里可以找到有关将其扩展到更大的程序/库的实际方面的指南?
- 我应该如何在文件系统上布置多个
.clj
文件? - 我应该如何组织和执行测试代码?
- 我应该如何记录程序/库?
- 我应该如何包装它?
我正在寻找有关从小脚本扩展到实际内容的实际方面的信息。
I've been learning some Clojure, and I currently have a single .clj
file which I edit in a text editor and which I execute on the command line.
Where can I find a guide on the practical aspects of scaling this up to larger programs/libraries?
- How should I lay out multiple
.clj
files on the filesystem? - How should I organize and execute test code?
- How should I document the program/library?
- How should I package it?
I'm looking for information on the practical aspects on scaling up from small scripts to something real.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用 leiningen。运行
将在当前工作目录中创建一个名为
myproject
的新文件夹,并具有默认的骨架结构。在新生成的
myproject
文件夹中,您会发现(除其他外)一个名为src
的文件夹用于 clojure 源代码,以及一个名为test
的文件夹用于您的测试(leiningen 将生成默认的失败测试)。Leiningen 将允许您使用 lein test 运行测试。
您可以使用 lein jar 将项目打包为 jar 文件,或者使用 lein uberjar 创建 uberjar(包含所有必需依赖项的可执行 jar)。
为了生成文档,我推荐 autodoc ,它与 leiningen 很好地集成。
I recommend using leiningen. Running
will create a new folder called
myproject
inside your current working directory with a default skeleton structure.Inside the newly generated
myproject
folder you'll find (among others) a folder namedsrc
for clojure source code and a folder namedtest
for your tests (leiningen will generate a default failing test).Leiningen will let you run your tests with
lein test
.You can package your project as a jar file with
lein jar
or create an uberjar (an executable jar with all required dependencies included) withlein uberjar
.For generating documentation I recommend autodoc which integrates nicely with leiningen.
如果您使用 Netbeans,有一个 Clojure 插件可能会对您有所帮助。
使用它创建一个 Clojure 项目会创建一堆文件夹:Source Packages,其中包含一个名为 com.yourcompany 的默认包、Test Packages、Libraries,其中包含 Clojure 的 .jar 和 JDK 的链接,以及 Test Libraries,其中包含JUnit。
If you are using Netbeans, there is a Clojure plugin which could be helpful to you.
Creating a Clojure project with it creates a bunch of folders: Source Packages, which contains a default package called com.yourcompany, Test Packages, Libraries, which contains the .jar for Clojure and a link to the JDK, and Test Libraries, which contains JUnit.
我使用以下组合:
祝你好运!
I use a combo of:
Good luck!