集成tomcat和eclipse作为热部署环境 [英] Integrating tomcat and eclipse as a hot-deploy environment

查看:27
本文介绍了集成tomcat和eclipse作为热部署环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以集成方式设置 eclipse 和 tomcat,以便在不需要部署的情况下立即反映对我的 JSP 和 servlet(如果可能)的更改.

I would like to setup eclipse and tomcat in an integrated fashion such that changes to my JSPs and servlets(if possible) are reflected immedietely without requiring a deployment.

好的,这是在互联网上有很多答案的问题之一,但它们看起来都不一样.(使用 Sysdeo 插件,使用 JBOss 插件,使用过时的 Eclipse,使用 MyEclipse 等),我找不到 1 个明确的资源来参考.因此,为了我的利益,最简单和最推荐的设置程序是什么?

Ok, this is one of those questions that has plenty of answers all across the internet but they all seem different. (use Sysdeo plugin, use JBOss plugin, do stuff with an outdated Eclipse, use MyEclipse instead etc.) and I couldn't find 1 definitive resource to refer to. So for my benefit, what is the simplest and most recommended procedure to set this up ?

这假设我有独立运行的 eclipse 和 tomcat.我实际上已经设法使用此处的说明以非热部署方式集成它们:http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

This assumes I have eclipse and tomcat running independently. I actually have managed to integrate them in a non-hot deploy fashion using instructions here : http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

Eclipse 版本版本:3.4.2 (Ganymede)Tomcat v6.0.20

Eclipse version Version: 3.4.2 (Ganymede) Tomcat v6.0.20

推荐答案

有两个选项.

首先,Eclipse 允许您执行此操作,只需稍微更改配置(另请参见 详细帖子)

First, Eclipse lets you do this, with a slight change of configuration (see also this detailed post)

  • 将Tomcat添加到服务器列表
  • 将项目设为动态 Web 项目"(通过创建向导或设置中的 facet 部分)
  • 将项目添加到tomcat,并配置其部署程序集"
  • 双击列表中的tomcat打开配置
  • 将发布"更改为从不自动发布"(这意味着当您按 ctrl+s 时服务器不会重新启动)
  • 在调试模式下启动 tomcat

这仍将反映代码更改,但不会重新启动服务器.

This will still reflect code changes but won't restart the server.

其次,我已经使用 FileSync 插件 很长时间了:

Second, I've used the FileSync plugin for a long time:

  • 配置插件以将所有类从bin Director发送到您的tomcat安装的WEB-INF/classes(这与配置部署程序集几乎相同)
  • 配置所有其他资源以转到其各自的位置
  • 可选地,将文件同步位置设置中的所有绝对路径外化为单个变量,并在 eclipse 中配置该变量(因此,如果所有成员都使用 eclipse,您也可以提交文件同步设置)
  • 在eclipse中将Tomcat添加到Servers列表中,将Server Locations"选项配置为Use tomcat installation"(在servers列表中双击tomcat会打开这个界面)
  • 在调试模式下启动 tomcat
  • configure the plugin to send all classes from the bin director to WEB-INF/classes of your tomcat installation (this is almost the same as configuring the deployment assembly)
  • configure all other resources to go to their respective locations
  • optionally, externalize all absolute paths from the filesync location settings to a single variable, and configure that variable in eclipse (thus you will be able to commit the filesync settings as well, if all members are using eclipse)
  • add Tomcat to the Servers list in eclipse, configure the "Server locations" option to be "Use tomcat installation" (the screen opens when you double-click tomcat from the servers list)
  • start tomcat in debug mode

这种方式对我来说非常适合.每一次非结构性变化都会立即反映出来,无需重新部署.

It works perfectly for me that way. Every non-structural change is reflected immediately, without redeploy.

更新:
您可以在此处详细了解热部署方法.
我还创建了一个项目,可以轻松地将工作区与 servlet 容器同步.

Update:
You can read more about the methods for hot-deploying here.
I also created a project that easily syncs the workspace with the servlet container.

这篇关于集成tomcat和eclipse作为热部署环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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