MAVEN打包丢失xml文件解决办法

时间:2021-08-01 07:43:44

MAVEN打包默认只包含src/main/java下的class文件,如果需要包含xml、properties等文件,请在build节点下面添加如下代码

<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<!-- 是否替换资源中的属性-->
<filtering>false</filtering>
</resource>
<!--
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/webapp</directory>
</resource>
-->
</resources>