如何用常春藤排除公共记录春季依赖性?

Arn*_*ter 11 dependencies ivy slf4j apache-commons-logging

我有一个使用常春藤进行依赖管理的ant的项目构建.我没有ivysetting文件,但是ivy.xml具有以下依赖项(我想使用spring与slf4j而不是commons日志记录):

<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>
Run Code Online (Sandbox Code Playgroud)

但是在解析编译配置时,commons-logging就解决了.我还尝试在显式spring-core依赖项上使用exclude,但commons-logging总是放在编译类路径中.

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

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

oer*_*ers 24

<exclude />由于未知原因,你的使用似乎被打破了.我在我的电脑上尝试了类似的东西,以下工作:
尝试顶级排除(直接在<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>
Run Code Online (Sandbox Code Playgroud)

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

  • 请注意,<exclude>标记位于依赖项的末尾.对我来说,不可能在依赖关系中的任何其他位置添加它,但最终. (2认同)