Gre*_*ams 6 jar clojure leiningen autodoc
在使用Leiningen时,我遇到了以下突然错误:
线程"main"中的异常java.lang.NoSuchMethodError:org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils; (core.clj:1)
我在https://github.com/technomancy/leiningen/issues/194找到了以下答案:
if ant version 1.6.1 is included in a project, lein fails. Autodoc "0.7.1" includes ant version 1.6.1.
a work around is to exclude ant.1.6.1 in the project.clj. <--- *1*
But a better solution is changing the order of lein classpath.
from bin/lein <--- *2*
CLASSPATH="$CLASSPATH:$LEIN_LIBS:$LEIN_DIR/src:$LEIN_DIR/classes:$LEIN_DIR/resources:$LEIN_JAR"
**changes to : **
CLASSPATH="$LEIN_LIBS:$LEIN_DIR/src:$LEIN_DIR/classes:$LEIN_DIR/resources:$LEIN_JAR;$CLASSPATH"
Run Code Online (Sandbox Code Playgroud)
我读的Leiningen教程https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md,并在样本project.clj文件https://github.com/technomancy/leiningen/blob/stable /sample.project.clj,但我仍然有以下问题:
1)在上面标记为1的行上,我无法告诉如何排除特定版本的jar文件.
2)在2,上面,究竟是什么bin/lein?我的Leiningen项目没有bin目录,Leiningen本身就是一个脚本,所以那里没有bin目录?
非常感谢您的帮助.
附录8/6/11:对于Autodoc的具体问题,我找到了一个Autodoc的分支,为我解决了这个问题.只需将"[org.clojars.weavejester/autodoc"0.9.0"]"添加到project.clj> defproject> :dev-dependencies子句即可.然后,从命令行(目录等于你的leiningen项目的根目录),执行'lein autodoc',等待一段时间.
Sco*_*ott 11
回答(1)我不确定他是否说你需要排除特定版本的Ant,但更有可能的是你可以通过排除由Autodoc引入的Ant版本来解决问题(无论什么版本).你可以尝试类似的东西:
(defproject my-project "1.0.0"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[autodoc "0.7.1" :exclusions [org.apache.ant/ant]]])
Run Code Online (Sandbox Code Playgroud)
假设只在构建期间使用Autodoc,我在此处仅将其排除在dev-dependencies中.
对于(2),你是对的,Leiningen是一个脚本,但在问题报告中,作者建议编辑Leiningen脚本以通过改变Leiningen的CLASSPATH中引用的目录的顺序来解决问题.