• maven的pom.xml用<exclusion>解决版本问题


    用maven管理库依赖,有个好处就是连同库的依赖的全部jar文件一起下载,免去手工添加的麻烦,但同时也带来了同一个jar会被下载了不同版本的问题,好在pom的配置里面允许用<exclusion>来排除一些不需要同时下载的依赖jar 。

          比如配置struts-core,它会同时下载javassist和asm相关的jar,但版本又不够新,这时可以排除它们:

    [html] view plain copy
     
    1. <!-- Struts2 -->  
    2.         <dependency>  
    3.             <groupId>org.apache.struts</groupId>  
    4.             <artifactId>struts2-core</artifactId>  
    5.             <version>${struts.version}</version>  
    6.             <exclusions>  
    7.                 <exclusion>  
    8.                     <groupId>javassist</groupId>  
    9.                     <artifactId>javassist</artifactId>  
    10.                 </exclusion>  
    11.                 <exclusion<!-- we prefer our explicit version, though it should be the same -->  
    12.                     <groupId>asm</groupId>  
    13.                     <artifactId>asm</artifactId>  
    14.                 </exclusion>  
    15.                 <exclusion<!-- we prefer our explicit version, though it should be the same -->  
    16.                     <groupId>asm</groupId>  
    17.                     <artifactId>asm-commons</artifactId>  
    18.                 </exclusion>  
    19.                 <exclusion<!-- we prefer our explicit version, though it should be the same -->  
    20.                     <groupId>org.ow2.asm</groupId>  
    21.                     <artifactId>asm</artifactId>  
    22.                 </exclusion>  
    23.                 <exclusion<!-- we prefer our explicit version, though it should be the same -->  
    24.                     <groupId>org.ow2.asm</groupId>  
    25.                     <artifactId>asm-commons</artifactId>  
    26.                 </exclusion>  
    27.             </exclusions>  
    28.         </dependency>  


    版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/rocklee/article/details/51692054
  • 相关阅读:
    Python基础----内置函数补充、匿名函数、递归函数
    为arm-linux开发板挂载基于nfs的根文件系统
    vsftp上传553 Could not create file错误解决
    在itop4412移植linux4.14和设备树遇到的问题及解决
    itop4412uboot中支持usbhub
    上下界网络流
    lca(最近公共祖先(在线)) 倍增法详解
    lca(最近公共祖先(离线))
    最小费用最大流
    spfa模板+讲解
  • 原文地址:https://www.cnblogs.com/liu2-/p/9035922.html
Copyright © 2020-2023  润新知