如何组织、测试、记录和打包 Clojure 项目

发布于 2024-10-02 12:48:20 字数 277 浏览 2 评论 0原文

我一直在学习一些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少钕鈤記 2024-10-09 12:48:20

我建议使用 leiningen。运行

$ lein new myproject

将在当前工作目录中创建一个名为 myproject 的新文件夹,并具有默认的骨架结构。

在新生成的 myproject 文件夹中,您会发现(除其他外)一个名为 src 的文件夹用于 clojure 源代码,以及一个名为 test 的文件夹用于您的测试(leiningen 将生成默认的失败测试)。

Leiningen 将允许您使用 lein test 运行测试。

您可以使用 lein jar 将项目打包为 jar 文件,或者使用 lein uberjar 创建 uberjar(包含所有必需依赖项的可执行 jar)。

为了生成文档,我推荐 autodoc ,它与 leiningen 很好地集成。

I recommend using leiningen. Running

$ lein new myproject

will create a new folder called myproject inside your current working directory with a default skeleton structure.

Inside the newly generatedmyproject folder you'll find (among others) a folder named src for clojure source code and a folder named test 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) with lein uberjar.

For generating documentation I recommend autodoc which integrates nicely with leiningen.

梦里兽 2024-10-09 12:48:20

如果您使用 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.

与君绝 2024-10-09 12:48:20

我使用以下组合:

祝你好运!

I use a combo of:

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文