特殊需求下:资源导出问题
Maven的约定大于配置,如果遇到在项目中写的配置文件无法被导出,或者无法生效的问题(如非要将properties文件放到java目录下),则解决方案是,在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>