如何将罐子排除在莱宁根项目之外?
题
在使用Leiningen时,我得到以下突然错误:
线程“ main” java.lang.nosuchmethoderror中的例外:org.apache.tools.ant.util.fileutils.getFileutils() (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"
我读了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)at 2, ,上面,到底是什么 bin/lein
?我的Leiningen项目没有BIN目录,Leiningen本身就是一个脚本,所以那里没有bin目录?
非常感谢您的帮助。
附录8/6/11: 对于AUTODOC的特定问题,我找到了一个为我解决问题的AutoDoc。只需添加“ [org.clojars.weavejester/autodoc“ 0.9.0”]” :dev-dependencies
条款。然后,从命令行(目录等于Leiningen项目的根),执行“ Lein Autodoc”,然后等待一会儿。
解决方案
在回答(1)我不确定他是否说您需要排除特定版本的蚂蚁,但更有可能通过排除AutoDoc拔出的蚂蚁版本来解决问题(无论哪种版本)。您可以尝试类似的事情:
(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]]])
假设仅在构建过程中使用AutoDOC,我才在此处将其排除在DEV依赖性中。
对于(2),您是正确的,Leiningen是一个脚本,但是在问题报告中,作者建议对Leiningen脚本进行编辑,以通过更改Leiningen Class Path中引用的目录顺序来解决问题。