问题:maven由于约定大于配置,可能会遇到我们写的配置文件,无法被导出或者生效的问题(此处的配置文件指的是在java目录下,而不在resource目录下的配置文件)
java.lang.ExceptionInInitializerError
...........
...........
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error building sqlSession.
### The error may exist in com/simon/dao/UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException:
解决方法:在maven的pom.xml中加入以下配置
<!--在build中配置resources,防止资源导出失败的问题-->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。