I decided to put the whole environment of a specific configuration in a special source tree with the following structure:
+-src/ +-env/ +-dev/ +-test/ +-prod/
Then I set up the maven-war-plugin to have three different executions (default plus two extra), one for each environment, producing three different military files: beer-1.0-dev.war, beer-1.0-test.war and beer- 1,0-prod.war. Each of these configurations used standard output files from the project, and then copied the content from the corresponding src/env/ on directory to the output files, override the file that will be placed in the corresponding src/env/ directory. It is also supported by copying the full structure tree to the output directory. Thus, if, for example, you wanted to replace web.xml in the test, you simply created the following Directory:
src/env/test/WEB-INF/
and placed your web.xml test in this directory, and if you wanted to override the db.property file, the directory of the test environment in which you created the following directory was placed in the root directory:
src/env/test/WEB-INF/classes
and placed your db.property test in this directory.
I saved the src/main directory configured for the Development Environment. The reason for this was to be able to use the maven-jetty-plugin without any additional configuration. Configuration
Below you will find the maven-war configuration plugin that I used to do the following:
<plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <classifier>prod</classifier> <webappDirectory>${project.build.directory}/${project.build.finalName}-prod</webappDirectory> <webResources> <resource> <directory>src/env/prod</directory> </resource> </webResources> </configuration> <executions> <execution> <id>package-test</id> <phase>package</phase> <configuration> <classifier>test</classifier> <webappDirectory>${project.build.directory}/${project.build.finalName}-test</webappDirectory> <webResources> <resource> <directory>src/env/test</directory> </resource> </webResources> </configuration> <goals> <goal>war</goal> </goals> </execution> <execution> <id>package-dev</id> <phase>package</phase> <configuration> <classifier>dev</classifier> <webappDirectory>${project.build.directory}/${project.build.finalName}-dev</webappDirectory> <webResources> <resource> <directory>src/env/dev</directory> </resource> </webResources> </configuration> <goals> <goal>war</goal> </goals> </execution> </executions> </plugin>
Well, thatโs doable. But, in no more detail about a particular problem, it is difficult to be more precise.