如何避免 Grails 在每次更改时自动重建我的项目?
我有一个旧的 Grails 1.1.1 项目,我必须使用 STS Pro 将其升级到版本 1.3.5。
正如预期的那样,一些碎片漂浮在周围,可能会导致问题,但我不确定是否是造成问题的原因。
这就是问题所在:每次我保存一个类(Java 或 Groovy)时,它都会自动重建整个项目并创建一个 war 文件。
这是正常行为吗?实际上,我不太介意,只是因为构建在后台运行。问题是,构建有时会暂时锁定一些资源,并且我会收到一个恼人的弹出窗口,提示由于断言失败而无法部署。
顺便说一句,它没有说明断言是什么,所以我每次都必须单击“确定”。
这正在成为一种真正的痛苦。
帮助将不胜感激!
谢谢,
路易斯
I have an old Grails 1.1.1 project that I had to upgrade to version 1.3.5 with STS Pro.
As expected, some debris is floating around that may be causing issues, but I'm not sure that's causing the problem.
This is the problem: Every time I save a class (Java or Groovy), it automatically rebuilds the whole project and creates a war file.
Is this the normal behavior? Actually, I don't mind it that much, just because the build runs on the background. The problem is that the build sometimes locks some resources temporarily, and I am having an annoying popup that says that it could not deploy because an assertion failed.
By the way, it doesn't say what was the assertion, so I have to click "OK" every time.
This is becoming a real pain.
Help will be greatly appreciated!
Thanks,
Luis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据参考文档,你可以这样做:
但是,每次进行更改时都必须重新启动应用程序。
According to the reference documentation, you could do:
However, you'll have to restart the application every time you make a change.
看起来您正在使用新功能(2.5.1 的新增功能)将 grails 应用程序部署到 tc 服务器,而不是调用 grails run-app。
这是我们刚刚添加的一个新功能,因此它的边缘仍然很粗糙,并且可能会在并非完全必要时重建 war 文件。我建议您为此提出一个 jira 问题:
https://issuetracker.springsource.com/browse/STS
It looks like you are using the new feature (new to 2.5.1) to deploy your grails app to tc server, rather than calling grails run-app.
This is a new feature that we have just added and so it is still rough around the edges and may be rebuilding the war file when it is not entirely necessary. I'd recommend that you raise a jira issue for this:
https://issuetracker.springsource.com/browse/STS
安德鲁可能是对的。我从头开始创建了一个新的 Grails 项目,并使用命令 grails dev run-app (可以从 STS 运行)执行该项目。
我没有遇到任何问题,并且它的行为符合预期:我能够热部署对代码的更改,而无需重新生成和部署 WAR 文件。不幸的是,STS 中的控制台不会显示编译完成和 Web 应用程序准备就绪的时间,因此我必须等待一段时间才能刷新浏览器。
Andrew is probably right. I created a new Grails project from scratch, and executed the project using the command grails dev run-app (which can be run from STS).
I had no problems, and it behaved as expected: I was able to hot-deploy changes to my code, without regenerating and deploying a WAR file. Unfortunately, the console in STS does not show when it has finished compiling and the web-app is ready, so I have to wait a little bit before refreshing my browser.
我在调用 grails run-app 时遇到同样的问题。 STS 每次都会触发 WAR 构建,因此虽然我可以在浏览器中立即访问我的更改,但 STS 开始消耗 CPU 周期和时间。重建时暂停。
我经常忍不住存钱。我从小就玩太空探索,所以这已经成为很长一段时间的习惯。
I'm having the same issue calling grails run-app. STS is triggering the WAR build each time, so although I can access my changes instantly in the browser, STS starts chewing CPU cycles & pausing while it rebuilds.
I can't help saving often. I grew up playing space quest so it's been habit for a long long time.