如何用常春藤排除spring的公共日志依赖关系? [英] How to exclude commons logging dependency of spring with ivy?
问题描述
我有一个使用 ant 构建的项目,使用 ivy 进行依赖管理.我没有 ivysetting 文件,但有一个 ivy.xml
具有以下依赖项(我想将 spring 与 slf4j 一起使用而不是 commons 日志记录):
I have a project build with ant using ivy for dependency management. I have no ivysetting file, but an ivy.xml
with the following dependency (I want to use spring with slf4j instead of commons logging):
<configurations>
<conf name="compile" />
<conf name="runtime" extends="compile"/>
</configurations>
<dependencies>
<dependency org="org.springframework" name="spring-webmvc" rev="3.0.5.RELEASE" conf="compile->default">
<exclude org="commons-logging" name="commons-logging"/>
</dependency>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="compile->default" />
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.1" conf="runtime->default" />
</dependencies>
但是在解析编译配置时,commons-logging
被解析了.我还尝试在显式 spring-core
依赖项上使用排除,但 commons-logging
总是放在编译类路径中.
But when resolving the compile configuration, commons-logging
is resolved. I also tried to use the exclude on an explicit spring-core
dependency but commons-logging
is always placed into the compile classpath.
我的错是什么?这不是什么 不是使用 Commons Logging 描述 maven?它是常春藤虫吗?我需要一个特殊的设置吗?常春藤有东西缓存吗?有什么想法吗?
What is my fault? Isn't it that what Not Using Commons Logging describes for maven? Is it an ivy bug? Need I a special setting? Has ivy something cached? Any idea?
我用的是ant 1.8.2和ivy 2.2.0,在Eclipse中使用IvyDE也有同样的问题.
I use ant 1.8.2 and ivy 2.2.0, Using IvyDE in Eclipse has the same problem.
推荐答案
您对 <exclude/>
的使用似乎因未知原因而被破坏.我在我的电脑上尝试了类似的东西并且以下工作:
试试顶级排除(直接在<依赖关系/>
:
Your usage of the <exclude />
seems to be broken for unkown reasons. I tried something similar on my pc and the following worked:
Try the top-level exclude (which is directly under <dependencies />
:
<dependencies>
<dependency org="org.springframework" name="spring-webmvc" rev="3.0.5.RELEASE" conf="compile->default">
</dependency>
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="compile->default" />
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.1" conf="runtime->default" />
<exclude org="commons-logging"/>
</dependencies>
我不知道为什么另一个不工作.JIRA 中有一些关于排除和循环依赖的错误,但这似乎不适合这种情况.也许这是一个真正的错误.
I don't know why the other one is not working. There are some bugs in JIRA concerning exclude and circular dependencies, but that doesn't seem to fit this case. Maybe it's a real bug.
这篇关于如何用常春藤排除spring的公共日志依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!