Leiningen和Clojure CLI工具之间的区别是什么?我应该如何使用它们?

the*_*ian 14 clojure leiningen

我最近和Clojure一起玩.据我所知,Clojure生态系统中最受欢迎的依赖管理工具是Leiningen.但我也发现Clojure提供了可能取代Leiningen的CLI工具.由于Clojure的经验有限,我不太了解Leiningen和那些CLI工具之间的区别.我听说那些CLI工具很轻巧,这是什么意思?我应该如何使用它们?

luk*_*cki 8

CLI tools are more limited in scope than Leiningen - it's a small tool which you can use to launch a REPL quickly. Combined with tools.deps.alpha it can be used to run code and pull in 3rd party dependencies. You can read more about it here.

Leiningen can do all of that, plus:

  • create deployment artifacts (uberjars)
  • start a REPL server or connect to a running one
  • manage mixed projects (for example Clojure + Java or Clojure + Clojurescript)
  • run arbitrary tasks in your project
  • manage dependencies
  • plugin support (linters, deployment tools)
  • integrate with Maven

The Lein repository includes a sample project file, sample.project.clj, which is a bit overwhelming but shows all the things Lein can do.

在这一点上,Lein对于构建应用程序和库更有用-因为它具有您可能需要的所有功能。就是说,CLI工具+ tools.deps正在迅速获得人们的关注,并且有一些项目添加了Leiningen所缺少的所有内容。

  • @andy 有趣 - 你有任何证据支持这一点吗?根据最新的 Clojure 调查(2020 年,https://clojure.org/news/2020/02/20/state-of-clojure-2020) - 近 90% 的受访者使用 Lein,而 clj cli 大约为使用了50%。我仍然想说,即使没有插件,Lein 也提供了更好的开箱即用体验 - 特别是 uberjar 命令。 (2认同)