I need to produce different WARs from a Maven project, according to values that vary between profiles.
For some files, I have default values that may be overwritten by configuration. For example, I might have an images folder with default images, and the "prof1" profile might overwrite some of them, while the "prof2" profile might use only the default images.
I'm having troubles implementing this using the Maven War Plugin. I listed the different webresources in the config shown below, but the values are not overridden - instead, the default images are always shown. It's probably relevant that I placed the web application files into the /Webcontent/
directory, instead of /src/main/webapp
; I could switch back if needed.
Here's my maven war plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<overwrite>true</overwrite>
<webResources>
<resource>
<directory>${basedir}/WebContent</directory>
<excludes>
<exclude>**/resources/*</exclude>
</excludes>
</resource>
<resource>
<directory>${basedir}/WebContent/resources</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
</resource>
<resource >
<directory>${basedir}/version/${profile.name}</directory>
</resource>
</webResources>
<archiveClasses>false</archiveClasses>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix />
</manifest>
</archive>
</configuration>
</plugin>