多模块m2eclipse / WTP项目能否将实用程序模块部署到WEB-INF / classes中? [英] Can a multi-module m2eclipse/WTP project get utility modules deployed into WEB-INF/classes?

查看:143
本文介绍了多模块m2eclipse / WTP项目能否将实用程序模块部署到WEB-INF / classes中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



到目前为止,我已经有一个使用m2eclipse的Helios eclipse的工作原型,其中WTP插件部署了我们的大型Web应用到tomcat。部署是一个小的处理器密集型,但它的作品和应用程序启动。



这里有什么不同的是依赖项目如何部署。在我们的MyEclipse环境中,所有依赖项目都被部署到WEB-INF / classes文件夹中,所以在服务器运行的时候,IDE中的一个java类的更改只会将受影响的文件复制到服务器的WEB-INF /类,并将该类热插拔到JVM和...繁荣 - 实时更改到服务器。但是,在我的helios转换中,所有依赖项目都被JARed放入WEB-INF / lib中。这具有实际看起来像我们真正的maven构建的生产形象的优点,但开发环境受到严重的影响,因为热插拔能力似乎完全丧失。在这里,如果我在一个依赖项目中更改一个java类,那么m2eclipse将重新打包JAR,看到部署的Web应用程序不同步,并重新发布整个应用程序。这不仅是一个问题,即整个Web应用程序必须循环(我们坦率地说,由于其大小和巨大的初始化时间,我们坦白地做得不好),这也是日食在重新发布时的一个讨厌的延迟。 (对于我们的应用程序,大约需要一两分钟)。



所以我的问题是:有没有办法在依赖项目中进行更改以热插拔运行JVM并替换已部署的文件,而不会造成这种讨厌的重新处罚?我假设这意味着将这些类文件部署到WEB-INF /类,但不知道(a)可能或(b)作为此解决方案的一部分是非常必要的。



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



提前感谢

解决方案

您正在寻找 Re:WTP Tomcat热部署m2eclipse


如果启用服务模块
没有发布选项,然后一个
特殊的jar被添加到Tomcat
服务器,这允许Tomcat在WTP中支持
来控制web应用程序
的classpath。此外,实用程序
项目未组装到jar中。
相反,实用程序项目的
的Java输出文件夹包含在
web
应用程序的classpath中,有效地为
类文件提供服务直。如果禁用
自动加载上下文,并且
以调试模式运行,则您对
类的更改可以被热代码替换,因此
上下文不会不得不重新加载。
相信这将完成你
正在寻找的。

要这样做:




  • 转到服务器视图

  • 双击您的Tomcat服务器打开服务器设置

  • 服务器选项中,选择不发布的服务模块
  • 选项
  • 发布中,选择自动不发布选项


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!

解决方案

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

这篇关于多模块m2eclipse / WTP项目能否将实用程序模块部署到WEB-INF / classes中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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