如何用ivy排除spring的公共日志依赖?
我有一个使用 ant 使用 ivy 进行依赖管理的项目构建。我没有 ivysetting 文件,但有一个具有以下依赖项的 ivy.xml
(我想将 spring 与 slf4j 一起使用,而不是公共日志记录):
<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< /code> 已解决。我还尝试在显式
spring-core
依赖项上使用排除,但 commons-logging
始终放置在编译类路径中。
我有什么错?这不是 不是什么使用 Commons Logging 描述了 Maven?这是常春藤虫吗?我需要特殊设置吗? ivy有缓存什么东西吗?有什么想法吗?
我使用ant 1.8.2和ivy 2.2.0,在Eclipse中使用IvyDE也有同样的问题。
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>
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.
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?
I use ant 1.8.2 and ivy 2.2.0, Using IvyDE in Eclipse has the same problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您对
的使用似乎因未知原因而被破坏。我在我的电脑上尝试了类似的方法,结果如下:尝试顶级排除(直接在
:我不知道为什么另一个不起作用。JIRA 中存在一些关于排除和循环依赖项的错误,但这似乎不适合这种情况。或许这才是真正的 漏洞。
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 />
: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.
使用模块而不是名称
Use module instead of name
<exclude org="commons-logging" module="commons-logging"/>
上面作为一般排除可能更适合您。
put above as general exclude might work better for you.