I am working in a Maven web project through Eclipse. In the web.xml, I have a context-param which value should change according the profile I use when I run the
Don't believe everything you read on the Internet. You should remove src/main/webapp/WEB-INF/ from the resources list, it will just filter your web.xml to target/classes
Your maven-war-plugin configuration just needs :
org.apache.maven.plugins
maven-war-plugin
2.5
true
Now, whether you build in Maven CLI or within Eclipse, you need to enable one of these profiles. In command line, you need to run
mvn clean package -Pdesenv
In Eclipse (assuming you're using the Luna Java EE distribution or more recent), you can enable the profile you want by pressing Ctrl+Alt+P. If you enable desenv, you'll see the filtered web.xml under target/m2e-wtp/web-resources/WEB-INF/ This is the file that will get published to your application server.
If you happen to enable both profiles at the same time, the latest profile listed in your pom.xml takes precedence.
Personally, I would remove the production profile and put the production properties in the default properties section of your pom.xml. That way, you always filter your web.xml with actual values and you'll have less chances of accidentally building and deploying your app with non-production settings.
And in order to enable the desenv profile automatically in Eclipse, you can add the following activation rule :
desenv
m2e.version
false
More on dynamic resource filtering support in m2e-wtp here: https://developer.jboss.org/en/tools/blog/2011/05/03/m2eclipse-wtp-0120-new-noteworthy
And a screencast there : http://screencast.com/t/hwodHqODBB