<dependency>
<groupId>xxx.xxx.xxx</groupId>
<artifactId>xxxxx</artifactId>
<version>x.x.x</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
</exclusions>
</dependency>
如上所示,在 exclusions 内的单个 exclusion 指定要去除依赖,但不能使用 version 标签。
如上所示 将会指定去除 xxx.xxx.xxx 下的 org.slf4j.slf4j-log4j12等三个自依赖
注意
即使 exclusion 中要去除的依赖是该依赖下的所有依赖的包中去除,即使嵌套了多层依赖依旧可以去除,但一定要写对 groupId 以及 artifactId