Is it possible, by using ANT, to create 1 war-file out of two separate eclipse java web application projects? Besides from just copying the right files to the right places i would have to be able two create one single web.xml. Also some other files that exists in both projects should be united into one file.
If you want to package multiple web applications together, the standard format for that is an EAR file. <a href="http://en.wikipedia.org/wiki/EAR_(file_format)" rel="nofollow">http://en.wikipedia.org/wiki/EAR_(file_format)</a>Answer2:
Ant doesn't care about eclipse. It can grab stuff from anywhere.
But taking 2 separate web.xml and combining into 1 file.. not sure you can automatically do that. Too many variables with how that would happen.
What you COULD do is:<ol><li>Have project 1 all by itself in eclipse </li> <li>Have project 2 all by itself in eclipse</li> <li>Have common stuff like the super web.xml (that you make by hand) in a third project 3 </li> <li>Have ant pull the right stuff from all over and make a war.</li> </ol>
Sounds like a lot of work though. Why do you have 2 separate web.xml if they are going to the same war? Why not just make 1 big project?Answer3:
It is easy if there are no duplicate files. Then just unzip them on top of each other, and zip them back to a new WAR file.
If there are duplicates you need to determine what information goes in the resulting file. For merging web.xml files, the easiest is most likely by using an XML capable transformation tool. The typical choice is XSLT, and there is an XSLT engine available in Java 1.4 and newer.
The question is, however, if this can be fully automated or you need to have the authors of either WAR files know about the other (write snippets, etc). Please provide more details.