推荐的在 Eclipse 中开发嵌入式 Jetty 服务器的方式是什么?

huangapple go评论68阅读模式
英文:

What is the recommended way to develop wars for an embedded jetty server in eclipse?

问题

我正在开发一组独立的应用程序,它们共享一些常用的端点。我的设置方式是让每个应用程序都是一个独立的war包,并且有一个嵌入式的Jetty服务器来提供这些常用的端点。嵌入式Jetty服务器设置了这些端点并在启动时加载了这些war包。我们的每个客户都会安装不同的应用程序,但始终会有共同的部分,因此需要能够独立安装的应用程序war包。

这个基本架构运行得还不错,但在开发周期中,我需要构建每个应用程序的war包,然后使用嵌入式Jetty服务器运行整个系统。我希望在对任何应用程序文件进行更改时,整个系统能自动部署。

对于如何实现这一点,您有什么想法吗?

英文:

I'm working on a set of independent applications that share some common endpoints. The way I have it setup is to have each application be an independent war, and to have an embedded jetty server which provides those common endpoints. The embedded jetty server sets up the endpoints and loads the wars upon start. Each of our customers will have different applications installed, but will always have the common part, hence the need to have independently installable application wars.

This basic architecture is working ok, but in the development cycle I need to build each of the applications war to then run the whole thing with the embedded jetty server. I would like for the whole thing just to auto deploy when changes are made to any of the application files.

Any thoughts on how to do this?

答案1

得分: 0

使用DeploymentManagerWebAppProvider来查找Web应用并部署它们(它会在更改时自动重新部署)。

然后设置部署以使用已解压的Web应用程序目录,而不是WAR文件。

您甚至可以选择在单个位置设置部署的XML,指向每个Web应用程序项目的target/${project.build.finalName}目录(如果使用Maven)的内容。

这适用于许多情况,但并非所有情况都适用。

如果更改类或库,那么围绕内存泄漏和固定类加载器存在一类问题,这可能导致重新加载的Web应用程序的行为与您的预期不同。

参见
https://www.eclipse.org/jetty/documentation/current/preventing-memory-leaks.html

英文:

Use a DeploymentManager with a WebAppProvider to find the webapps and deploy them (it will auto-redeploy on change).

Then setup your deployment to use exploded webapp directories, not war files.

You can even opt to setup deployment XML's in a single place, pointing to the contents of each webapp project's target/${project.build.finalName} directory (if using maven).

This works for many things, but not ALL things.

If you change classes or libs then there's a category of issues around memory leaks, and pinned classloaders, that can result in your reloaded webapp not behaving as you expect.

See
https://www.eclipse.org/jetty/documentation/current/preventing-memory-leaks.html

huangapple
  • 本文由 发表于 2020年3月16日 23:30:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/60708798.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定