【问题标题】:How to exclude nested dependency in maven如何在maven中排除嵌套依赖
【发布时间】:2014-01-22 17:40:09
【问题描述】:

我有这个依赖树:

[INFO] +- org.springframework.ws:org.springframework.ws:jar:2.1.0.RELEASE:compile
[INFO] |  +- org.springframework:org.springframework.aop:jar:3.1.1.RELEASE:compile
[INFO] |  |  \- org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile
[INFO] |  +- org.springframework:org.springframework.oxm:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework.ws:org.springframework.xml:jar:2.1.0.RELEASE:compile
[INFO] |     \- org.apache.ws:com.springsource.org.apache.ws.commons.schema:jar:1.3.2:compile

我想排除(最后一个):

org.apache.ws:com.springsource.org.apache.ws.commons.schema:jar:1.3.2

这是(根据它的pom):

<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>

所以我在根工件(org.springframework.ws)中定义:

<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>org.springframework.ws</artifactId>
    <version>2.1.0.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
        </exclusion>
    </exclusions>
</dependency>

并没有真正改变。我想排除的工件仍然存在。任何人都可以帮助我如何使其工作?

【问题讨论】:

    标签: java spring maven dependency-management spring-ws


    【解决方案1】:

    排除不排除单独的类。它适用于工件,即 jar 文件。您确实可以使用这样的标签排除第三方依赖:

        <exclusion>
            <groupId>org.apache.ws</groupId>
            <artifactId>com.springsource.org.apache.ws.commons.schema</artifactId>
        </exclusion>
    

    地点:

    • org.apache.ws 是组 ID
    • com.springsource.org.apache.ws.commons.schema 是工件 ID

    (来自您的依赖关系树示例)。

    我不认为有排除特定类的内置能力。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-14
      • 1970-01-01
      • 2016-08-13
      • 2012-02-25
      • 2017-05-17
      • 2015-03-15
      • 2019-10-29
      相关资源
      最近更新 更多