首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

【转】MAVEN 摩擦

2012-10-07 
【转】MAVEN 冲突commons-digester-1.8commons-digester-1.2在做struts1.3+hiberante3.2+spring2.5项目时,使

【转】MAVEN 冲突

commons-digester-1.8

commons-digester-1.2

在做struts1.3+hiberante3.2+spring2.5项目时,使用maven管理lib,myEclipse做ide.

发现spring-tomcat-weaver.jar需要commons-digester-1.2

而有些包struts-core-1.3需要commons-digester-1.8

commons-digester jar

1.8和1.2产生了冲突,

所以把spring-tomcat-weaver依赖于1.2的commons-digester排除

<dependency>
??? ??? ??? <groupId>org.springframework</groupId>
??? ??? ??? <artifactId>spring-tomcat-weaver</artifactId>
??? ??? ??? <version>2.5.6</version>
??? ??? ??? <exclusions>
??? ??? ??? ??? <exclusion>
??? ??? ??? ??? ??? <groupId>commons-digester</groupId>
??? ??? ??? ??? ??? <artifactId>commons-digester</artifactId>
??? ??? ??? ??? </exclusion>
??? ??? ??? </exclusions>
??? ??? </dependency>

但是部署到tomcat6中,发现项目还是有1.2和1.8,难道maven写错了?

查找了半天,才发现,在maven的pom.xml中写完排除后,原来项目lib中的1.2没有删除。写了pox.xml的排除1.2,maven不会再加入1.2的包,

但是maven也没有自动地把原来lib中的 1.2包删除,所以出现了再部署到tomcat6中,还是出现了1.2和1.8.

把项目lib中的1.2包手动删除才行。

看来maven不是全自动的,以前没有用maven时,很注意lib中包的检查,现在费了很长时间才找到原因。

参考文档

1.http://www.iteye.com/problems/24668

2.http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html

热点排行