idea编译后xml等配置文件无法和class文件一起出现在target报下,从而导致文件生效问题
因为maven约定大于配置,只会识别resource目录下的xml等配置文件,而不会识别src/main/java包下xml等配置文件,有时候导致放在src/main/java包的文件无法被放到target包下
- 方法一:
把src/main/java包下xml等配置文件移到resource目录下即可
- 方法二:
在pom文件加入下列内容即可 <!--在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>