问题: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>