的答案很簡單:
Maven的資源插件增加了反聲明順序的資源:
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<!-- The resources will be placed in reversed order in the war
that means first entry will be added as last resource and may override other resources -->
<resource>
<!-- ATTENTION! we need the config-local declration at first cause it shall be placed as last resource in the classpath -->
<directory>config-local</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
只是移動在上面的配置本地資源,它會被添加爲最後的資源和可能會覆蓋其他默認文件。 如果文件夾不存在,Maven會毫無問題地跳過它。