多模块 m2eclipse/WTP 项目能否将实用程序模块部署到 WEB-INF/类中?

发布于 2024-09-12 15:26:07 字数 965 浏览 8 评论 0原文

我们目前使用 MyEclipse 及其内置的 Maven4MyEclipse 集成和内置的 J2EE 服务器支持,但希望转换为常规 Eclipse(特别是 Helios)以便能够在 Windows 上使用其 64 位安装。 (MyEclipse 尚不支持 Windows 上的 64 位。)

到目前为止,我已经有了一个 Helios eclipse 的工作原型,它使用 m2eclipse 和 WTP 插件将我们的大型 Web 应用程序部署到 tomcat。部署需要占用一些处理器资源,但它可以正常工作并且应用程序会启动。

这里的关键不同之处在于依赖项目的部署方式。在我们的 MyEclipse 环境中,所有依赖项目都部署到 WEB-INF/classes 文件夹中,因此当服务器运行时,对 IDE 中的 java 类进行更改只会将受影响的文件复制到服务器的 WEB-INF/classes 并将该类热插拔到 JVM 中,然后...繁荣 - 对服务器进行实时更改。非常适合调试。

然而,在我的 helios 转换中,所有依赖项目都被 JARed 并放入 WEB-INF/lib 中。这样做的优点是实际上看起来像我们真正的 Maven 构建的生产映像的样子,但开发环境因此受到严重不利,因为热插拔功能似乎完全丧失了。在这里,如果我更改依赖项目中的 java 类,m2eclipse 将重新打包 JAR,看到部署的 Web 应用程序不同步,并重新发布整个应用程序。这不仅是一个问题,因为整个 Web 应用程序必须循环(坦率地说,考虑到它的大小和巨大的初始化时间,我们的应用程序做得不好),而且它也是 Eclipse 重新发布的一个令人讨厌的延迟。 (对于我们的应用程序,这大约需要一两分钟。)

所以我的问题是:有没有一种方法可以让依赖项目内部的更改热交换到正在运行的 JVM 并替换已部署的文件,而无需这种令人讨厌的重新发布惩罚?我假设这意味着将这些类文件部署到 WEB-INF/classes,但不确定作为此解决方案的一部分是否 (a) 可能或 (b) 确实必要。

其他人正在做什么来解决这个问题?可以解决吗?

提前致谢!

We currently use MyEclipse with its built-in Maven4MyEclipse integration and its built-in J2EE server support, but want to convert over to regular eclipse (Helios specifically) to be able to use its 64-bit install on windows. (MyEclipse does not yet support 64-bit on Windows.)

So far I've got a working prototype of Helios eclipse using m2eclipse with the WTP plugin deploying our large web application to tomcat. Deployment is a little processor intensive, but it works and the app starts up.

What is critically different here is how the dependent projects are deployed. In our MyEclipse environment all of the dependent projects were deployed exploded out into the WEB-INF/classes folder, and so while the server was running, a change to a java class in the IDE would copy only the affected file(s) to the server's WEB-INF/classes and hot-swap the class into the JVM and... boom - live change to the server. GREAT for debugging.

In my helios conversion, however, all dependent projects get JARed and put into WEB-INF/lib. This has the advantage of actually looking like what our real maven-built production image looks like, but the development environment is severely disadvantaged by this in that the hot-swapping capability seems to be totally lost. Here, if I change a java class in a dependent project, m2eclipse will re-package the JAR, see that the deployed web application is out of sync, and republish the whole application. Not only is this a problem in that the entire web application has to cycle (something ours frankly doesn't do well given its size and huge initialization time), it is also a nasty delay in eclipse doing its republish. (For our application this takes about a minute or two.)

So my question is this: is there a way to get changes inside dependent projects to hot-swap to the running JVM and replace deployed files without this nasty republish penalty? I am assuming that this means deploying those class files to the WEB-INF/classes but don't know for sure that is (a) possible or (b) really necessary as part of this solution.

What are others doing to solve this? Is it solvable?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天涯沦落人 2024-09-19 15:26:07

我认为您正在寻找 回复:WTP Tomcat 使用 m2eclipse 热部署

如果您启用“服务模块
没有发布”选项,然后
特殊的jar被添加到Tomcat中
允许 Tomcat 支持的服务器
在 WTP 中控制“类路径”
网络应用程序。另外,实用性
项目不会组装到 jar 中。
相反,Java 输出文件夹
公用事业项目包括在
网络的“类路径”
应用,有效服务
直接.class文件。如果您禁用
上下文的自动加载,以及
在调试模式下运行,您所做的更改
类可以进行热代码替换,因此
上下文不必重新加载。我
相信这会实现你的目标
正在寻找。

为此:

  • 转至服务器视图
  • 双击 Tomcat 服务器以打开服务器设置
  • 服务器选项中,选择提供模块而不发布选项
  • 发布中,选择从不自动发布选项

I think that you are looking for the solution described in Re: WTP Tomcat hot deploy with m2eclipse:

If you enable the "Serve Modules
Without Publishing" option, then a
special jar is added to the Tomcat
server which allows the Tomcat support
in WTP to control the "classpath" of
the web application. Also, utility
projects are not assembled in to jars.
Instead, the Java output folder(s) of
the utility projects are included in
the "classpath" of the web
application, effectively serving the
class files directly. If you disable
the auto-loading for the context, and
run in debug mode, changes you make to
classes can be hot-code-replaced so
the context doesn't have to reload. I
believe this will accomplish what you
are looking for.

To do so:

  • Go to the Server view
  • Double-click your Tomcat server to open the server settings
  • In Server Options, select the Serve modules without publishing option
  • In Publishing, select the Never publish automatically option
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文