Maven中资源导出问题解决方案--pom.xml配置
maven由于他的约定大于配置,我们之后可能遇到我们没写在resources目录中的配置文件无法导出或生效的问题,解决方案:
<!-- 在Build中配置resources 来防止除了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>
不过最好还是把资源文件放在resources文件夹中