简体   繁体   English

Eclipse Tomcat Build Publishing缓慢

[英]Eclipse Tomcat Build Publishing slow

Setup 设定

I have a project in Eclipse that I want to deploy to a local Tomcat server. 我在Eclipse中有一个项目要部署到本地Tomcat服务器。 The project was part of a git repo. 该项目是git repo的一部分。 I cloned the repo and imported the project. 我克隆了回购并导入了该项目。 I then installed Web Tools, created the server, etc.. The only change I made to .classpath was removing two libs and changing the container (jre) to use the workplace default. 然后,我安装了Web Tools,创建了服务器等。我对.classpath所做的唯一更改是删除两个库并更改容器(jre)以使用工作区默认值。

The project is very small and the build time is milliseconds. 该项目非常小,构建时间为毫秒。 There is never any activity indicators or anything in the Progress view. Progress视图中从不存在任何活动指示符或任何内容。 The server is local so there should be no delays there. 服务器是本地的,所以不应该有延迟。

On the server: 在服务器上:

  • Modules auto reload by default is checked Modules auto reload by default会检查Modules auto reload by default
  • Automatically publish when resources change is selected 选择Automatically publish when resources change
  • Publishing interval (in seconds) is 1 Publishing interval (in seconds)Publishing interval (in seconds)为1
  • My module has Auto Reload enabled 我的模块已启用Auto Reload
  • The server is shown as [Started, Synchronized] (sometimes [Started, Restart] ) 服务器显示为[Started, Synchronized] (有时[Started, Restart]
  • My module is shown as Synchronized 我的模块显示为Synchronized


Symptoms 症状

  • Modifying source and saving causes a redeploy after a delay of up to 5 seconds (too slow!) when I have Build Automatically enabled. 当我Build Automatically启用Build Automatically时,修改源和保存会导致在延迟最多5秒(太慢!)之后重新部署。
  • A manual build ( Build Project with Build Automatically disabled) rarely causes a redeploy. 手动构建( Build Project with Build Automatically disabled) 很少导致重新部署。
  • A manual publish (right-clicking the server and selecting Publish ) usually causes a redeploy if done after a manual build that did not redeploy. 手动发布(右键单击服务器并选择“ Publish通常会导致重新部署,如果在未重新部署的手动构建之后完成。 There can be a couple second delay on this as well. 这也可能有几秒钟的延迟。
  • Restarting the server doesn't help. 重新启动服务器没有帮助。
  • Restarting Eclipse does not help. 重启Eclipse没有帮助。


Question

Optimally I would like to auto-deploy right after saving changes to my source instead of having to wait 5 seconds for it to redeploy. 最好我想在保存对源的更改后立即自动部署,而不是等待5秒钟才能重新部署。 The problem seems to be with the interval at which Build Automatically checks to see if it needs to build. 问题似乎是Build Automatically检查是否需要构建的时间间隔。 Is there a way to shorten this? 有没有办法缩短这个?

Why does Build Automatically always cases a redeploy but Build Project rarely does? 为什么Build Automatically 总是会重新部署,但Build Project 很少呢?

Why is there a delay between when I manually publish and when the redeploy actually begins? 为什么在手动发布和重新部署实际开始之间存在延迟? Is there a way to fix/shorten this? 有没有办法解决/缩短这个?

I didn't think Build Automatically would be necessary given the server's Automatically publish when resources change property. 鉴于服务器Automatically publish when resources change属性,我不认为Build Automatically是必要的。 What is this for? 这个是来做什么的?


Thanks, - Mike 谢谢, - 迈克



OSX 10.8.5 OSX 10.8.5

Eclipse Standard/SDK Eclipse Standard / SDK
Version: Kepler Service Release 2 版本:开普勒服务版本2
Build id: 20140224-0627 构建ID:20140224-0627

Tomcat v7 Tomcat v7

We eventually managed to resolve (at least one variant) of the 'Eclipse slow publishing issue' as being an issue with m2e-wtp . 我们最终设法解决(至少一个变体)'Eclipse慢发布问题'作为m2e-wtp的问题。 We found the mappings it uses under .settings/org.eclipse.wst.common.component . 我们在.settings/org.eclipse.wst.common.component下找到了它使用的映射。 We then modified these mappings to copy individual webapp folders one-at-a-time. 然后,我们修改了这些映射,以便一次一个地复制单个webapp文件夹。 Specifically, we avoided copying very large, nested folders such as node_modules . 具体来说,我们避免复制非常大的嵌套文件夹,例如node_modules

After editing the file and refreshing the Eclipse project, the publishing pause is gone! 编辑文件并刷新Eclipse项目后,发布暂停消失了! You have to be careful that future changes (such as doing Maven > Update Project ) do not override the .settings/org.eclipse.wst.common.component file. 您必须小心,未来的更改(例如执行Maven > Update Project )不会覆盖.settings/org.eclipse.wst.common.component文件。

You can configure Eclipse's build folder (for any generated class files) to save directly to the deployed web app's classes folder. 您可以将Eclipse的构建文件夹(对于任何生成的类文件)配置为直接保存到已部署的Web应用程序的classes文件夹。 This essentially skips the deploy step. 这基本上会跳过部署步骤。

Then, if you add a script / step to touch a watched resource (like web.xml ) each time you want to review your changes, it'll reload the context with the new class files in its class path. 然后,如果每次要查看更改时添加脚本/步骤以touch监视资源(如web.xml ),它将在其类路径中使用新类文件重新加载上下文。 This generally takes about a second. 这通常需要大约一秒钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM