文章目录

今天调试一个Java测试项目时出现报错:

Cause: com.ibatis.sqlmap.client.SqlMapException: There is already a statement named XXXX in this SqlMap.

增加调试参数 -verbose:class 发现报错的相关Jar出现2个不同版本。

为什么会带来这样的问题:
1、测试项目为了调试方便依赖了一堆其他项目
2、项目全部依赖ivy
3、某个项目的ivy相关Jar做了升级,其他项目未升级
4、加载ibatis的xml使用了classpath*,不同的版本的jar,Spring会当作2个不同的资源来处理
Failed to parse mapping resource: URL [jar:file:/D:/Local_Repository/ivy-cache/xxx/xxx/jars/xxx-1.5.0.10.jar!/xxx/xxx/xxx.xml];

解决办法:
1、项目的ivy使用了 rev=”latest.integration”,依赖的全部项目都要做Resolve。
2、使用ivy的 Show in Reverse Dependency Explorer 中的 Show all projects in workspace 功能检查jar的冲突

文章目录