当前位置:首页> 正文

如何配置 maven 的 resources 的资源复制为强制覆盖???

如何配置 maven 的 resources 的资源复制为强制覆盖???


如果maven复制的资源中,包含同名的资源,往往需要后面的复制覆盖前面的复制,但是maven的资源复制默认是不覆盖的。


比如:

<resources>
<!-- 复制资源 -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>


<!-- 复制特定 profile 的资源 -->
<resource>
<directory>src/main/resources/${resource_dir}</directory>
<!--<filtering>true</filtering>-->
<includes>
<include>**/*</include>
</includes>
</resource>


</resources>


这种情况下,可以通过配置 maven.resources.overwrite 的属性值来变更这个行为:


<properties>
<maven.resources.overwrite>true</maven.resources.overwrite>
</properties>

展开全文阅读

相关内容