且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven排除传递依赖项的传递依赖项

更新时间:2022-06-11 22:43:34

您可以将D<exclusions>元素添加到A的POM中的依赖项B.排除在递归依赖项上递归工作.

You can add an <exclusions> element for D to the dependency B in the POM of A. Exclusions work recursively on transitive dependencies.

对复杂项目执行此操作的一种好方法是在父POM中使用<dependencyManagement>元素,该元素会排除您不想在任何地方看到的任何内容.

A good way to do this for a complex project is to use an <dependencyManagement> element in the parent POM which excludes anything you don't want to see anywhere.