如何从leiningen项目中排除jars? [英] How do I exclude jars from a leiningen project?

查看:658
本文介绍了如何从leiningen项目中排除jars?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Leiningen时,出现以下突然错误:

While using Leiningen, I got the following abrupt error:

线程main中的异常java.lang.NoSuchMethodError:org.apache.tools.ant.util .FileUtils.getFileUtils()Lorg / apache / tools / ant / util / FileUtils; (core.clj:1)

Exception in thread "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"

我阅读Leiningen教程 https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md 和示例project.clj文件 https://github.com/technomancy/leiningen/blob/stable/sample.project.clj ,但我仍然有以下问题:

I read the Leiningen tutorial at https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md and the sample project.clj file at https://github.com/technomancy/leiningen/blob/stable/sample.project.clj, but I still have the following questions:

1)在上面标记为 1 的行中,

1) At the line marked 1, above, I can't tell how to exclude a specific version of a jar file.

2)在 2 上面,正是 bin / lein ?我的Leiningen项目没有bin目录,Leiningen本身是一个脚本,所以没有bin目录有?

2) At 2, above, exactly what is bin/lein? My Leiningen project doesn't have a bin directory, and Leiningen itself is a script, so there's no bin directory there?

非常感谢您的帮助。

附录8/6/11:对于Autodoc的特定问题,我发现了一个Autodoc的分支解决了我的问题。只需添加[org.clojars.weavejester / autodoc0.9.0]到project.clj> defproject> :dev-dependencies 子句。然后,从命令行(目录等于leiningen项目的根目录)执行'lein autodoc',然后等待一段时间。

Addendum 8/6/11: For the specific problem with Autodoc, I found a fork of Autodoc that fixes the problem for me. Just add "[org.clojars.weavejester/autodoc "0.9.0"]" to project.clj > defproject > :dev-dependencies clause. Then, from the command line (with the directory equal to the root of your leiningen project), execute 'lein autodoc', and wait for a while.

推荐答案

在回答(1)我不知道他是否说你需要排除一个特定的Ant版本,但更有可能你可以解决这个问题,通过排除被拉入的Ant版本通过Autodoc(无论什么版本)。你可以尝试如下:

In answer to (1) I'm not sure if he's saying that you need to exclude a specific version of Ant, but more likely that you can fix the issue by excluding the version of Ant that's pulled in by Autodoc (no matter what version). You could try something like:

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



我已经在dev-

I've only excluded it in dev-dependencies here, assuming that Autodoc is only to be used during a build.

对于(2),你是正确的,Leiningen是一个脚本,但在问题报告中,作者是建议编辑Leiningen脚本以通过更改Leiningen的CLASSPATH中引用的目录的顺序来解决该问题。

For (2), you are correct, Leiningen is a script, but in the issue report, the author is suggesting an edit to the Leiningen script to fix the issue by changing the order of directories referenced in Leiningen's CLASSPATH.

这篇关于如何从leiningen项目中排除jars?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆