How do I include different web.xml files in order to switch between production and development builds?

Erik Hatcher

Several ways to do this kind of thing, but the simplest is to put your two different web.xml files into different directories named 'production' and 'development' (or alternatively name your files web-production.xml and web-development.xml) - just as long as the words 'development' and 'production' are part of the filename.

Then you can do a copy:

<copy todir="build/WEB-INF" file="WEB-INF/${build.destination}/web.xml"/>
<copy todir="build/WEB-INF" file="WEB-INF/web-${build.destination}.xml"/>
Another way to handle this is to have a single tokenized web.xml (if only some values change between the two) and use a filtered copy (load ${build.production}.properties).