I am trying to create different WAR builds using profiles for my different production sites. Each site requires different configuration files. I think I am confused on how to use build profiles.
My plan was this: 1)Create a base configuration for the war plugin that includes my basic configuration: <build> . . . <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <webResources> <resource> <directory>${basedir}/src/main/conf/server</directory> <includes> <include>log4j.xml</include> </includes> <targetPath>WEB-INF/classes</targetPath> </resource> <resource> <directory>${basedir}/src/main/reports</directory> <targetPath>WEB-INF/reports</targetPath> </resource> <resource> <directory>${basedir}/src/main/baseconf</directory> <targetPath>WEB-INF</targetPath> </resource> </webResources> </configuration> </plugin> 2)Now I need to add the special configuration for each production site so I create a profile with each with additional configuration files: <profiles> <profile> <id>site1</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <webResources> <resource> <directory>${basedir}/src/main/conf/server/production-site-1</directory> <targetPath>WEB-INF</targetPath> </resource> </webResources> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>site2</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <webResources> <resource> <directory>${basedir}/src/main/conf/server/production-site-2</directory> <targetPath>WEB-INF</targetPath> </resource> </webResources> </configuration> </plugin> </plugins> </build> </profile> </profiles> 3)mvn clean install war:war -o -Psite1 This doesn't work. The war file gets built with the base configuratio files but the special configuration items in the profile don't get moved over. The output actually says it is copying those files over but I dont' see them. I wonder if they then get deleted? My understanding was that the profile would add additional resources to those already configured in the base build. Is that behavior incorrect? Do I need to redo the entire webResources section in the profile? thanks -ryan