使用 Maven/Eclipse 开发时可以同时运行两个 webapps 吗? [英] Possible to run two webapps at once when developing with Maven/Eclipse?

查看:31
本文介绍了使用 Maven/Eclipse 开发时可以同时运行两个 webapps 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题在于:我们为客户构建网络应用程序.我们还有一个admin"webapp,可以修改一些客户端数据结构.由于数据的性质,两个 Web 应用程序必须在同一个 JVM 中运行.

Here's the problem: we build webapps for clients. We also have an "admin" webapp that modifies some client data structures. Because of the nature of the data, both webapps have to run in the same JVM.

这在生产中没有问题;您只需将两个 Web 应用程序放在同一个应用程序服务器中即可.

This is no problem in production; you just put two webapps in the same app server.

不过,我们最近改用了 Maven 式的 Web 应用布局方式,而 Maven 想要每个项目一个 Web 应用.在 Eclipse 中,这是一个问题,因为如果您独立运行不同的 web 应用程序,它们将位于不同的 JVM 中.

We've recently switched to a Mavenish way of laying out webapps, though, and Maven wants one webapp per project. In Eclipse it's a problem, because if you run the different webapps independently, they'll be in separate JVMs.

我们正在尝试使用 jetty-maven-plugin 进行 webapp 测试,但如果可以解决这个问题,可以切换到其他东西.

We're trying to use the jetty-maven-plugin to do webapp testing, but could switch to something else if it would solve this problem.

推荐答案

回答我自己的问题:

这似乎是不可能的.我们提出的解决方法是编写一些嵌入式码头代码并从我们的应用程序中启动它.Jetty 允许您以编程方式添加多个 web 应用程序.它还允许您为每个 Web 应用程序创建多个资源库,即目录,从而启用覆盖.到目前为止,效果很好.

It appears that this just isn't possible. The workaround that we've come up with is to write a little embedded jetty code and launch it from within our app. Jetty allows you to add multiple webapps programmatically. It also allows you to create multiple resource bases, that is, directories, per webapp, which enables overlays. So far, it works great.

这篇关于使用 Maven/Eclipse 开发时可以同时运行两个 webapps 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆