Вопрос

I have this dependency tree:

[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

And I want to exclude (last one):

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

which is (according to its pom):

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

So I define in root artifact (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>

And nothing really changes. Artifact I wanted to exclude is still present. Anyone can help me how to make it working?

Это было полезно?

Решение

Exclusion does not exclude separate class. It works with artifacts, i.e. jar files. You indeed can exclude the third party dependency using tag like this:

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

Where:

  • org.apache.ws is group ID
  • com.springsource.org.apache.ws.commons.schema is artifact ID

(from your dependency tree example).

I do not thing that there is a built-in ability to exclude specific class.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top