Clojure 如何从leiningen项目中排除JAR?

Clojure 如何从leiningen项目中排除JAR?,clojure,jar,leiningen,autodoc,Clojure,Jar,Leiningen,Autodoc,在使用Leiningen时,我遇到了以下突然错误: 线程“main”java.lang.NoSuchMethodError中出现异常:org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;(核心clj:1) 我在网站上找到了以下答案: 如果项目中包含ant版本1.6.1,lein将失败。Autodoc“0.7.1”包括ant版本1.6.1。 解决方法是在project.clj中

在使用Leiningen时,我遇到了以下突然错误:

线程“main”java.lang.NoSuchMethodError中出现异常:org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;(核心clj:1)

我在网站上找到了以下答案:

如果项目中包含ant版本1.6.1,lein将失败。Autodoc“0.7.1”包括ant版本1.6.1。
解决方法是在project.clj中排除ant.1.6.1 在回答(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]]])
我在这里只在开发依赖项中排除了它,假设Autodoc只在构建过程中使用

对于(2),您是对的,Leiningen是一个脚本,但在问题报告中,作者建议编辑Leiningen脚本,通过更改Leiningen的类路径中引用的目录顺序来修复问题

(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]]])