I have a web application Maven project, and I want to customize the web.xml file depending on the Profile that is running. I am using the Maven-War-plugin, which allows me
is there a way to have two web.xml files and select the appropriate one depending on the profile?
Yes, within each profile you can add a configuration of the maven-war-plugin and configure each to point at a different web.xml.
profile1
org.apache.maven.plugins
maven-war-plugin
/path/to/webXml1
...
As an alternative to having to specify the maven-war-plugin configuration in each profile, you can supply a default configuration in the main section of the POM and then just override it for specific profiles.
Or to be even simpler, in the main of your POM, use a property to refer to the webXml attribute and then just change it's value in different profiles
path/to/default/webXml
profile1
path/to/custom/webXml
org.apache.maven.plugins
maven-war-plugin
${webXmlPath}
...