

However, if your web.xml is complex and you pose a greater risk of 4-5 copies of the web.xml getting out of sync, this may be an approach that will work for you. It's ugly, and the xml is hard to modify in this form.
When you want to exclude all of the security, you define them as follows: keeps everything in one web.xml while still making both it and the pom.xml readable.

There's a third, compromise option which I implemented in my project. 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

Īs 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. Yes, within each profile you can add a configuration of the maven-war-plugin and configure each to point at a different web.xml. Is there a way to have two web.xml files and select the appropriate one depending on the profile?
