maven的全局去除依赖

我们在maven中有时候希望将某个依赖包彻底去除


如我们的系统使用的是spring3.1.2, 但是依赖的二方包中, 总是或多或少依赖了spring2.5.6, 希望有个方法, 能全局去除掉


Java代码   收藏代码
  1. <!-- globally exclusion -->  
  2. <dependency>  
  3.     <groupId>org.springframework</groupId>  
  4.     <artifactId>spring</artifactId>  
  5.     <version>2.5.6.SEC03</version>  
  6.     <scope>provided</scope>  
  7. </dependency>  


以上方式, 有个弊端, 就是eclipse中, 还是会依赖, 且容易用混


有三个方案(建议使用第三种)
Xml代码   收藏代码
  1. <dependency>  
  2.     <groupId>org.springframework</groupId>  
  3.     <artifactId>spring</artifactId>  
  4.     <version>99.0-does-not-exist</version>  
  5.     <scope>provided</scope>  
  6. </dependency>  


Xml代码   收藏代码
  1. <dependency>  
  2.     <groupId>org.springframework</groupId>  
  3.     <artifactId>spring</artifactId>  
  4.     <version>2.5.6</version>  
  5.     <scope>system</scope>  
  6.     <systemPath>${basedir}/lib/empty.jar</systemPath>  
  7. </dependency>  


Xml代码   收藏代码
  1. <plugin>  
  2.     <artifactId>maven-eclipse-plugin</artifactId>  
  3.     <configuration>  
  4.         <downloadSources>true</downloadSources>  
  5.         <downloadJavadocs>true</downloadJavadocs>  
  6.         <classpathContainers>  
  7.             <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>  
  8.         </classpathContainers>  
  9.         <excludes>  
  10.             <exclude>org.springframework:spring</exclude>  
  11.         </excludes>  
  12.     </configuration>  
  13. </plugin>  
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值