Most of the time resource files for different environments are largely the same. They only have minor differences. In those scenarios it is quite cumborsome to parse through the entire file to find the small changes. It makes sense to put those minor differences in a properties files and move the full files to a common location. For example take logback.xml file. The file is usually only differs in server address, port and a few other things. It makes sense to move those into a properties file in each of the environment directories and move a single logback.xml file into a common location. So the directory structure looks something like this.
Now all wars will have logback.xml and the logback.xml is filtered using envspec.properties for each environment individually.
With this there will be two steps to filtering:
<plugin> <groupId>net.sf.environments-maven-plugin</groupId> <artifactId>environments-maven-plugin</artifactId> <version>1.1.0-SNAPSHOT</version> <configuration> <targetPath>some/where/inside</targetPath> <commonDir>common</commonDir> <filters> <filter>envspec.properties</filter> </filters> </configuration> <executions> <execution> <goals> <goal>environment</goal> </goals> </execution> </executions> </plugin>
NOTE: