由于开发人员使用不同的开发工具,导致eclipse的开发人员将mapper.xml文件习惯性的放到package下,以便查看,而eclipse编译时,不会忽略package下的xml以及dtl文件,所以eclipse不会出现此类问题
而idea在maven项目下,编译代码时是依赖maven去编译代码,对于idea而言,package下的文件只有.java文件是值得保留的,所以我们需要在pom下指定我们要保留的package下的.xml文件:
1 <build> 2 <finalName>smedia_finance</finalName> 3 <resources> 4 <resource> 5 <directory>src/main/java</directory> 6 <includes> 7 <include>com/smedia/china/special/dao/*.java</include> 8 <include>com/smedia/china/special/dao//*.xml</include> 9 </includes> 10 <!-- 是否替换资源中的属性--> 11 <filtering>false</filtering> 12 </resource> 13 </resources> 14 </build>