<build>
<defaultGoal>compile</defaultGoal>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
在pom.xml的build标签下加入以上代码,再重新Rebuild Project
项目结构如下,是不需要把UserMapper.xml放到resource中的,且mybatis-config.xml
内有
<!--a Mapper.xml need regist in Mybatis core configuration file-->
<mappers>
<mapper resource="com/kuang/dao/UserMapper.xml"/>
</mappers>
target下没有手动复制的UserMapper.xml也能执行