<build>
<!-- 需要替换的文件位置 -->
<filters>
<filter>src/main/filters/filter-${env}.properties</filter>
</filters>
<resources>
<!--这个是java的文件操作,不需要过滤-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<!--这个是真正的资源文件,需要过滤的-->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.json</include>
<include>**/*.yml</include>
<include>**/*.js</include>
<include>**/*.html</include>
<include>**/*.css</include>
<include>**/*.svg</include>
<include>**/*.jpg</include>
<include>**/*.jpeg</include>
<include>**/*.png</include>
<include>**/*.ico</include>
<include>**/*.woff2</include>
<include>**/*.txt</include>
<include>**/*.xlsx</include>
<include>**/*.xls</include>
</includes>
<excludes>
<exclude>env/*.properties</exclude>
</excludes>
</resource>
<!--这个也是资源文件,不需要过滤的,可以单独拉出来设置filtering为false 防止docx文件内容乱码-->
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.docx</include>
</includes>
</resource>
</resources>
</build>
原文地址:
https://tech.souyunku.com/?p=44575