I prefer use maven profiles for this situation.
For example we have directory structure:
src/main/resources
|
+- local
| |
| `- specific.properties
+- dev
|
`- specific.properties
In pom.xml define two profiles:
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources/local</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>dev</id>
<build>
<resources>
<resource>
<directory>src/main/resources/dev</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
In that case, I dont need to update every time pom.xml for new files. In IDE simply switch profiles, or use -P flag from command line.
UPD: what to do if some properties are the same for configurations?
Make the configuration like this:
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/config/local</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>dev</id>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/config/dev</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
Common part will be stored in src/main/resources
and other configs will be in appropriate folders in config directory.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…