Do not believe everything that you read on the Internet. You should remove src / main / webapp / WEB-INF / from the list of resources, it will just filter your web.xml to target/classes
You only need the maven-war-plugin configuration:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.5</version> <configuration> <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors> </configuration> </plugin>
Now, whether you are building in the Maven CLI or inside Eclipse, you need to enable one of these profiles. At the command prompt you need to run
mvn clean package -Pdesenv
In Eclipse (if you are using a Luna Java EE or later distribution), you can enable the profile you want by pressing Ctrl+Alt+P If you enable desenv , you will see the filtered web.xml under target/m2e-wtp/web-resources/WEB-INF/ This is the file that will be published on your application server.
If you need to enable both profiles at the same time, the last profile specified in your pom.xml takes precedence.
Personally, I delete the production profile and put the production properties in the default properties section of your pom.xml. This way you always filter your web.xml with the actual values, and you will have less chance of accidentally creating and deploying your application with non-production settings.
And to enable the desenv profile automatically in Eclipse, you can add the following activation rule:
<profile> <id>desenv</id> <activation> <property> <name>m2e.version</name> </property> </activation> <properties> <ambiente.producao>false</ambiente.producao> </properties> </profile>
Read more about dynamic resource filtering support in m2e-wtp here: https://developer.jboss.org/en/tools/blog/2011/05/03/m2eclipse-wtp-0120-new-noteworthy
And there is a screencast there: http://screencast.com/t/hwodHqODBB