War archives merging: how to merge the web.xml into a single one

My goal is to merge war archives from several artifacts, and hence to have all of the web.xml merged into a single one. For doing, I first exploded each of the war archives into the same directories and rename each of the web.xml. Now, the next step is to merge each of these web.xml into a single one. Is there a way to do that with gradle? By using XmlFileContentMerger (and in this case how to use it (there is no useful explanation or examples about its use in the manual)?