maven衝突問題

 

經過配置文件解決問題:html

http://stamen.iteye.com/blog/2030552spring

1.用命令dependency:tree獲得依賴關係spa

(或者加上Dincludes或者Dexcludes說出你喜歡或討厭限制 例:mvn dependency:tree -Dverbose -Dincludes=asm:asm  )code

2.找到不想要的jar的位置xml

3.最後在pom上修改htm

將不想要的傳遞依賴剪除掉 blog

   承上,假設咱們不但願asm:asm:jar:1.5.3出現,根據分析,咱們知道它是經由org.unitils:unitils-dbmaintainer:jar:3.3引入的,那麼在pom.xml中找到這個依賴,作其它的調整: get

<dependency>  
    <groupId>org.unitils</groupId>  
    <artifactId>unitils-dbmaintainer</artifactId>  
    <version>${unitils.version}</version>  
    <exclusions>  
        <exclusion>  
            <artifactId>dbunit</artifactId>  
            <groupId>org.dbunit</groupId>  
        </exclusion>  
        <!-- 這個就是咱們要加的片段 -->  
        <exclusion>  
            <artifactId>asm</artifactId>  
            <groupId>asm</groupId>  
        </exclusion>  
    </exclusions>  
</dependency>

 

因爲引入jar順序問題的解決辦法:

http://mrlee23.iteye.com/blog/1926787it

若是你pom.xml裏面你把spring-asm-3.1.4和spring-core-3.2.4同時引進去的話(注意:必定要注意順序,是spring-asm-3.1.4在前,spring-core-3.2.4在後,這會引發包衝突)io

解決辦法:

一、在pom.xml中去掉spring-asm-3.1.4的引用,由於spring-core-3.2.4已經把asm這個代碼從新打包進去了

spring-core-3.2.4 包

2.若是必需要用spring-asm-3.1.4的話,就在pom文件中,把spring-core-3.2.4的引用放在spring-asm-3.1.4以前(利用類加載順序,但不建議這麼作,會帶來一些問題)

<dependency>  
    <groupId>org.springframework</groupId>  
    <artifactId>spring-core</artifactId>  
    <version>3.2.4.RELEASE</version>  
</dependency>  
<dependency>  
    <groupId>org.springframework</groupId>  
    <artifactId>spring-asm</artifactId>  
    <version>3.1.4.RELEASE</version>  
</dependency>  
相關文章
相關標籤/搜索