I'm a little puzzled by the resources tag in spring-boot-starter-parent version 2.2.4.RELEASE. What is the purpose of having the include and exclude with the same patterns?
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/application*.yml</include>
<include>**/application*.yaml</include>
<include>**/application*.properties</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application*.yml</exclude>
<exclude>**/application*.yaml</exclude>
<exclude>**/application*.properties</exclude>
</excludes>
</resource>
</resources>
The maven-resources-plugin filter option, allows you to include variables in your resources. The variables will be interpolated in the resources which are copied to the output directory.
The spring-boot-starter-parent contains 2 resources blocks.
The first contains <filter>true</filter>, which means that variables will be interpolated. The first contains an includes filter, indicating that the variable interpolation will only be executed for these files.
The second doesn't contain <filter>true</filter>, which means that de default value (= false) will be used and that no interpolation will be done. The second also contains an excludes filter, indicating that the files specified in this filter will be excluded by this resource block.
So the first block will copy all application*.(yml|yaml|properties) files to the output folder, and will interpolate variables. And the second block will copy all other files, without interpolating variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With