zoukankan      html  css  js  c++  java
  • maven的pom.xml用<exclusion>解决版本问题

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

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

        <!-- Struts2 -->  
                <dependency>  
                    <groupId>org.apache.struts</groupId>  
                    <artifactId>struts2-core</artifactId>  
                    <version>${struts.version}</version>  
                    <exclusions>  
                        <exclusion>  
                            <groupId>javassist</groupId>  
                            <artifactId>javassist</artifactId>  
                        </exclusion>  
                        <exclusion> <!-- we prefer our explicit version, though it should be the same -->  
                            <groupId>asm</groupId>  
                            <artifactId>asm</artifactId>  
                        </exclusion>  
                        <exclusion> <!-- we prefer our explicit version, though it should be the same -->  
                            <groupId>asm</groupId>  
                            <artifactId>asm-commons</artifactId>  
                        </exclusion>  
                        <exclusion> <!-- we prefer our explicit version, though it should be the same -->  
                            <groupId>org.ow2.asm</groupId>  
                            <artifactId>asm</artifactId>  
                        </exclusion>  
                        <exclusion> <!-- we prefer our explicit version, though it should be the same -->  
                            <groupId>org.ow2.asm</groupId>  
                            <artifactId>asm-commons</artifactId>  
                        </exclusion>  
                    </exclusions>  
                </dependency>  
  • 相关阅读:
    POJ 1129 深搜&四色染图&模拟
    POJ 1011 很经典的树枝拼凑的深度搜索
    HDU 2564 词组缩写
    Java中的split函数的用法
    java中next和nextline的区别
    简探this和super
    再探Java中的继承加载顺序
    Java面向接口编程小例子 2
    Dos命令整理集(持续更新)
    VMware WorkStation9.0虚拟机如何运行WINPE
  • 原文地址:https://www.cnblogs.com/bj20170624/p/7792017.html
Copyright © 2011-2022 走看看