민서네집

[이클립스] Server - 실행 시 다른 프로젝트 참조하는 법 본문

Java

[이클립스] Server - 실행 시 다른 프로젝트 참조하는 법

브라이언7 2017. 8. 25. 12:29

Technical details of serve modules without publishing in Eclipse WTP and Tomcat?


https://stackoverflow.com/questions/15575302/technical-details-of-serve-modules-without-publishing-in-eclipse-wtp-and-tomcat


[발췌]


The idea is to serve a web application directly from the scattered directory structure of the development workspace, without packaging modules into JARs which then end up in WEB-INF/libin a WAR.

The main benefits are:

  • You don't need to build archives.
  • When you change a resource in your workspace, the change is reflected in the running webapp without redeploying the webapp or restarting the server.

With Servlet 3.0, web resources may also be bundled in library JARs in META-INF/resources, so classes and resources may come from multiple workspace directories.

Tomcat 7.0 supports a VirtualWebappLoader and a VirtualDirContext to configure a web application based on a collection of scattered resource and class directories.

To serve your web app directly from your Eclipse workspace, WTP generates a suitable Tomcat configuration matching your project structure in $WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/conf/server.xml

For some reason, WTP does not directly use the Tomcat loader and context implementations but has its own WtpDirContext and WtpWebappLoader which are slightly different but similar. (I believe this approach is older than the current solution in Tomcat. There is some special logic for TLD scanning - I'm not sure if this is still required with the latest Tomcat versions.) These helper classesare contained in the org.eclipse.jst.server.tomcat.runtime.70.loader.jar you noticed.

Without Serve modules without publishing, when you change a web resource in META-INF/resources in a library module, this change will not be directly visible in the running application after reloading the current page in the browser.


Comments