I have a Maven app with three different profiles listed below
<profiles> <profile> <id>dev</id> <properties> <profileVersion>DEV</profileVersion> <webXmlFolder>${id}</webXmlFolder> </properties> </profile> <profile> <id>test</id> <properties> <profileVersion>1.0.0-RC1</profileVersion> <webXmlFolder>${id}</webXmlFolder> </properties> </profile> <profile> <id>prod</id> <properties> <profileVersion>1.0.0-Final</profileVersion> <webXmlFolder>${id}</webXmlFolder> </properties> </profile> </profiles>
And I have a Maven structure like this:
Src / main / configuration / default / WEB -INF / web.xml
SRC / Main / configuration / DEV / WEB-INF / web.xml
Src / main / configuration / test / WEB-INF / web.xml
Src / Main / configuration / Prod / WEB-INF / web.xml
SRC / Primary / WebApp / WEB-INF /
My task is to install the assigned web.xml in webapp / WEB-INF during construction, it depends on the given profile. If no profile is specified, then web.xml copies from the default folder.
I have a plugin but it does not work.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>copy-prod-resources</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <outputDirectory>${project.build.outputDirectory}/classes/WEB-INF</outputDirectory> <resources> <resource> <directory>src/main/config/${webXmlfolder}/WEB-INF</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin>
Any ideas? I spent a lot of time on this problem and Im a bit confused.
source share