Search code examples
javamavenpom.xml

exclude transitive shaded dependency in maven


In my project i want to exclude jackson-databind from tinkerpop. It doesn't get excluded. I have open the pom.xml of tinkerpop https://github.com/apache/tinkerpop/blob/master/gremlin-shaded/pom.xml and I can see jackson is shaded. I have tried to exclude it:

<groupId> org.apache.tinkerpop.shaded.jackson </groupId> also this way <groupId>com.fasterxml.jackson.core</groupId>

Both approaches didn't worked out.

<dependencies>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-driver</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-all</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.tinkerpop.shaded.jackson</groupId> // com.fasterxml.jackson.core
                    <artifactId>jackson-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
<dependencies>

How to exclude the shaded dependency ? Thank you


Solution

  • If tinkerpop shaded the other jar, and included the resulting classes into the final tinkerpop jar (which is usually be the case), then this other jar cannot be excluded because it has become part of tinkerpop.