看看是否可以以某种方式重新组织资源,以便可以对资源应用过滤器,并且每个配置中都始终存在大多数文件。
假设您有一个属性文件,对于不同的配置需要不同的值。可以用如下变量替换该值:
url=${url}
mode=${mode}
<profile>
<id>production</id>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>[non-resource file #1]</exclude>
<exclude>[non-resource file #2]</exclude>
<exclude>[non-resource file #3]</exclude>
</excludes>
</resource>
</resources>
</build>
<properties>
<url>www.something.com</url>
<mode>production</mode>
</properties>
</profile>
<profile>
<id>development</id>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>[non-resource file #1]</exclude>
<exclude>[non-resource file #2]</exclude>
<exclude>[non-resource file #3]</exclude>
</excludes>
</resource>
</resources>
</build>
<properties>
<url>localhost:8080/something</url>
<mode>development</mode>
</properties>
</profile>