1、如何更改 pom.xml 文件
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<!-- 自己按需添加 文件类型 -->
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.json</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<!-- 自己按需添加 文件类型 -->
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.jpg</include>
<include>**/*.ttf</include>
<include>**/*.xml</include>
<include>**/*.json</include>
</includes>
<filtering>true</filtering>
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
</resource>
</resources>
</build>
精简版
<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>
2、如果无法生效,按步骤操作
2.1、 clean target
-
未清理 target 之前
1.png -
点击 clean 之后
2.png
2.2、结束项目运行,并重新打开idea并重新运行项目。
3.png3、其他信息
2022年03月17日16:18:44
3.1、 idea
- IntelliJ IDEA 2021.2 (Ultimate Edition)
3.2、 tomcat
- apache-tomcat-8.5.72
3.3、maven
- apache-maven-3.8.4
网友评论