Eclipse Deployment Assembly - Creates .war of dependency project inside main project WEB-INF/lib?

﹥>﹥吖頭↗ 提交于 2019-12-10 19:39:05

问题


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.

To take an example, I have MainApp and functions.reportsApp.

When building these with ant the following happens:

- 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 

This works fine, and as I understand .war and .jar spec, is correct.

In Eclipse though, I want to have both projects open and deploy/develop to the Tomcat server setup there. I have the following:

Imported both projects, setup MainApp to have ReportsApp as a project dependency (via, MainApp-Properties, Java Build Path, Projects).

NOTE: MainApp's web.xml specifies:

<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/reportsApp-faces-config.xml,
/WEB-INF/mainApp-faces-config.xml
</param-value>

reportApp's web.xml specifies:

<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/reportsApp-faces-config.xml
</param-value>

I notice in MainApp-Properties-Deployment Assembly that Eclipse created:

src:functions.reportsApp, deployPath: WEB-INF/lib

This turns up deployed by Eclipse as Tomcat/webapps/MainApp/WEB-INF/lib/functions.reportsApp.war. WAR? This makes no sense to me and doesn't work.

To make it work, I have to:

  • Add to MainApp a folder which I (via the Advanced section) Link to ReportApp's web directory.
  • Add to MainApp's Deployment Assembly that linked folder and select MainApp's web folder as the 'Folder for deployment descriptor'

That gets me the web/* (JSF, etc.) content into Tomcat/webapps/MainApp and the WEB-INF content of ReportsApp merged into WEB-INF of MainApp.

I also have to make sure that MainApp's Deployment Assembly contains functions.reportsApp.jar to ensure that it gets deployed to tomcat under MainApp/WEB-INF/lib.

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?

Related questions:

  • Set up an Eclipse Dynamic Web Project referencing another project
  • Adding a Web Project as a jar in an Eclipse Deployment Assembly

来源:https://stackoverflow.com/questions/15361509/eclipse-deployment-assembly-creates-war-of-dependency-project-inside-main-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!