maven 依赖排除

时间:2023-03-10 06:38:44
maven 依赖排除

在项目中遇到一个问题,项目使用spring 3.x,引用了某些包,这些包又依赖了spring2.x,造成项目无法启动.这种情况就需要用到maven的依赖排除,配置如下:

  使用以下代码排除依赖xxxx引用的spring包

 <dependency>
<groupId>com.xxx.xxx</groupId>
<artifactId>xxxx</artifactId>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>