Create single web app (WAR) from multiple web applications
<p>We already having an spring web application (maven project) say webApp1 which is hosted on production and working fine but now due some business requirements we want to develop an another web application say webApp2. </p>

<p>So some clients demands both apps, or some either one of them. we need freedom of which module to be deployed, there can be the case where some clients don't want webApp1 so deployment package must include only webApp2 or sometimes both.</p>

<p><strong>Approach 1:</strong></p>

<p>Lets create another maven project and develop individually, at the time of creating deployment package use of <code>Apache Ant</code> can be done which will create <code>WAR</code> file by combining libs,views,controllers of both the applications or of one. combining web.xml,root-context.xml,servlet-context.xml may be the manual task.</p>

<p><strong>Approach 2:</strong> </p>

<p>After searching on approach 1 I come to know about <code>EAR</code> (similar question <a href="https://stackoverflow.com/a/2936464/1629242">https://stackoverflow.com/a/2936464/1629242</a>).</p>

<p><code>EAR</code> package (similar question <a href="https://stackoverflow.com/a/2936464/1629242">https://stackoverflow.com/a/2936464/1629242</a>) can be the approach, but for this <strong>do I need to convert existing application as EAR? or what changes are required in existing working web application webApp1?</strong> also how I can control which module need to be added in <code>EAR</code></p>