clojure - lein-autodoc 与 Leiningen 2

标签 clojure leiningen autodoc

我正在尝试使用lein-autodoc ,因为我相信它是 Clojure 的首选文档生成器。我已按照 lein-autodoc github 页面上的说明将 :dev-dependency [[lein-autodoc "0.9.0"]] 添加到我的项目定义中。

运行 lein deps 运行没有问题,但是 lein autodoc 失败,声称 autodoc 不是任务。

我怀疑问题在于 lein-autodoc 设置为与 leiningen 1 一起使用。但是,我使用的是 leiningen 2。是否有其他方法可以使用 autodoc 调用 lein?或者 lein-autodoc 软件包未设置为与 lein 2 一起使用?如果没有,是否还有另一个首选的 lein2 兼容文档生成选项?

编辑:

根据下面的 Cubic 提示,我创建了 ~/.lein/profiles.clj,如下所示:

{:user {:plugins [[lein-autodoc "0.9.0"]]}}

现在,运行 lein autodoc 会产生以下结果:

$ lein autodoc
Exception in thread "main" java.lang.IllegalAccessError: sh does not exist
    at clojure.core$refer.doInvoke(core.clj:3778)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$load_lib.doInvoke(core.clj:5279)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:603)
    at clojure.core$load_libs.doInvoke(core.clj:5298)
    (...)

这表明 autodoc 可能与 Lein 2 不兼容?如果没有,是否有适用于 Lein 2 的文档系统?

最佳答案

autodoc 曾经是更常见的文档生成器,但现在它主要仅用于 Clojure 本身(并且针对该任务进行了优化)。我强烈建议您使用codox反而。非常好。您可以在我自己的项目之一中看到它的实际应用 here

(我知道其他答案中已说过这一点,但为了使我的答案完整,我仍然需要添加它)

此外,在 leiningen 2 中没有 :dev-dependencies 键。相反,有一个 :dev 配置文件。请查看 Leiningen 配置文件文档以获取更多信息。在这种情况下,您所需要做的就是将 :plugins 键添加到您的项目或全局用户配置文件中,其中包含您想要的插件(例如 codox、autodoc 等)。

关于clojure - lein-autodoc 与 Leiningen 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13978057/

相关文章:

clojure - 我可以向 clojure 类型添加字段吗?

clojure - Clojure 中的 seq 函数注意事项

java - lein 编译问题 (Clojure)

intellij-idea - 莱宁根 > 2.8.1 和草书?

python - 'autodoc_default_flags' 在 python Sphinx 配置中如何工作?

clojure - 如何在 clojure 中获取 `doc` 函数的输出?

multithreading - 函数式编程中不可变数据的问题

clojure - Leiningen 提出了 "Tried to use insecure HTTP repository without TLS."但对于哪个依赖项?

python - Sphinx autodoc 给出警告 : py:class reference target not found: type warning

python - 如何使用 sphinx autodoc 阻止 "Index"和 "Python Module Index"出现?