maven由于他的约定大于配置,可能会遇到所写的配置文件无法被导出或者生效问题。其解决方案是在项目配置文件中build中配置resources,来防止我们的资源导出失败
<!--在build中配置resources,防止资源导出失败问题-->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
ps:输入后要记得刷新maven。