如何排除春季与常春藤的相依性? [英] How to exclude commons logging dependency of spring with ivy?

查看:153
本文介绍了如何排除春季与常春藤的相依性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目构建与ant使用ivy进行依赖管理。我没有ivysetting文件,但是一个 ivy.xml 具有以下依赖关系(我想使用spring with slf4j而不是commons logging):

 < configurations> 
< conf name =compile/>
< conf name =runtimeextends =compile/>
< / configurations>
<依赖关系>
< dependency org =org.springframeworkname =spring-webmvcrev =3.0.5.RELEASEconf =compile-> default>
< exclude org =commons-loggingname =commons-logging/>
< / dependency>
< dependency org =org.slf4jname =slf4j-apirev =1.6.1conf =compile-> default/>
< dependency org =org.slf4jname =jcl-over-slf4jrev =1.6.1conf =runtime-> default/>
< / dependencies>

但是解决编译配置时, commons-logging 已解决。我也试图在显式的 spring-core 依赖关系中使用exclude,但是 c $ c> commons-logging 总是放在编译classpath。



我的错是什么?这不是不是使用Commons Logging 描述了maven?它是常春藤虫吗?需要我一个特殊的设置?常春藤有东西缓存吗?任何想法?



我使用ant 1.8.2和ivy 2.2.0,在Eclipse中使用IvyDE也有同样的问题。

解决方案

您的使用< exclude /> 似乎因未知因素而被打破。我在我的电脑上尝试过类似的东西,以下工作:

尝试顶级排除(直接位于< dependencies /> 之下:

 < dependencies> 
< dependency org =org.springframeworkname =spring-webmvcrev =3.0.5.RELEASEconf =编译 - >默认>
< / dependency>
< dependency org =org.slf4jname =slf4j-apirev =1.6.1conf = > default/>
< dependency org =org.slf4jname =jcl-over-slf4jrev =1.6.1conf =runtime-> default/>
< exclude org =commons-logging/>
< / dependencies>


$ b $我不知道为什么另一个不工作,JIRA中有一些关于排除和循环依赖关系的错误,但这似乎并不适合这种情况,也许这是一个真正的错误。


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.

解决方案

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>

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.

这篇关于如何排除春季与常春藤的相依性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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