in my pom file, the configuration is as follows
<profiles>
<profile>
<id>office</id>
<properties>
<profileActive>office</profileActive>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
...
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>application.properties</exclude>
<exclude>application-home.properties</exclude>
<exclude>application-office.properties</exclude>
<exclude>application-prod.properties</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.properties</include>
<include>application-${profileActive}.properties</include>
</includes>
</resource>
</resources>
</build>
my understanding is that the above configuration causes the result resource file packaged by target to contain two files, one is application.properties, and the other is application-$ {profileActive} .properties, which is application-prod.properties because active profile is prod,. The above configuration is to first exclude all application .properties files from exclude out of the package results, and then add two application .properties files to include.
but read some articles, as if the filter is to replace the key-value pairs in the contents of the file, rather than which resource file is not included in the package. This is not consistent with my above understanding, but my understanding is consistent with the results. What"s going on?
and oddly enough, when the second filtering is false, the value of application-$ {profileActive} .properties cannot be overridden by the value in application.properties at runtime, while in true, the runtime can. However, the application.properties file itself has not changed in the packaging result.