title: Eclipse Deployment Assembly - Creates .war of dependency project inside main project WEB-INF/lib?
body: <p>I have a main web project that contains all the things required to deploy and hit the page via a browser. Then I have several "functions" each as a separate project that can be included into the main project.</p>
  
  <p>To take an example, I have <strong>MainApp</strong> and <strong>functions.reportsApp</strong>.</p>
  
  <p>When building these with <code>ant</code> the following happens:</p>
  
  <pre>
  - MainApp.war
    - mainApp/jsf/Pages.faces, etc
    - reportsApp/jsf/Reports.faces, etc
    - WEB-INF/web.xml, mainapp-faces-config.xml, reportsApp-faces.config.xml, etc
    - WEB-INF/lib
       - MainApp.jar
         - META-INF/* (MainApp's)
         - my/company/MainApp/Code.class 
       - functions.reportsApp.jar
         - META-INF/* (reportsApp's)
         - my/company/reportsApp/Code.class 
  </pre>
  
  <p>This works fine, and as I understand <code>.war</code> and <code>.jar</code> spec, is correct. </p>
  
  <p>In Eclipse though, I want to have both projects open and deploy/develop to the Tomcat server setup there. I have the following:</p>
  
  <p>Imported both projects, setup <strong>MainApp</strong> to have <strong>ReportsApp</strong> as a project dependency (via, MainApp-Properties, Java Build Path, Projects).</p>
  
  <p>NOTE: MainApp's <code>web.xml</code> specifies:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;param-name&gt;javax.faces.CONFIG_FILES&lt;/param-name&gt;
  &lt;param-value&gt;
  /WEB-INF/reportsApp-faces-config.xml,
  /WEB-INF/mainApp-faces-config.xml
  &lt;/param-value&gt;
  </code></pre>
  
  <p>reportApp's <code>web.xml</code> specifies:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;param-name&gt;javax.faces.CONFIG_FILES&lt;/param-name&gt;
  &lt;param-value&gt;
  /WEB-INF/reportsApp-faces-config.xml
  &lt;/param-value&gt;
  </code></pre>
  
  <p>I notice in MainApp-Properties-Deployment Assembly that Eclipse created:</p>
  
  <p><code>src:functions.reportsApp, deployPath: WEB-INF/lib</code></p>
  
  <p>This turns up deployed by Eclipse as <code>Tomcat/webapps/MainApp/WEB-INF/lib/functions.reportsApp.war</code>. <strong>WAR?</strong> This makes no sense to me and doesn't work.</p>
  
  <p>To make it work, I have to:</p>
  
  <ul>
  <li>Add to MainApp a folder which I (via the Advanced section) Link to ReportApp's web directory. </li>
  <li>Add to MainApp's Deployment Assembly that linked folder and select MainApp's web folder as the 'Folder for deployment descriptor'</li>
  </ul>
  
  <p>That gets me the <code>web/*</code> (JSF, etc.) content into <code>Tomcat/webapps/MainApp</code> and the WEB-INF content of ReportsApp merged into WEB-INF of MainApp.</p>
  
  <p>I also have to make sure that MainApp's Deployment Assembly contains <code>functions.reportsApp.jar</code> to ensure that it gets deployed to tomcat under <code>MainApp/WEB-INF/lib</code>.</p>
  
  <p>Surely Eclipse could have figured all this itself? That one web app depending on another web app MUST mean that the dependency would have to be deployed correctly?</p>
  
  <p>Related questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4646684">Set up an Eclipse Dynamic Web Project referencing another project</a></li>
  <li><a href="https://stackoverflow.com/questions/4657304">Adding a Web Project as a jar in an Eclipse Deployment Assembly</a></li>
  </ul>