Eclipse 中的 Jetty - 从 .war 加载静态内容
我在 Eclipse 中运行 Jetty,并与 Jetty 服务器适配器一起安装。我正在构建一个 Tapestry 应用程序,并且实时类重新加载效果非常好。然而,对静态资产(例如图像和 CSS)的更改不会立即反映出来:我必须执行 Jetty 重新启动-重建-重新部署,这非常慢。
我认为原因是我的应用程序被部署为 .war,而 Jetty 正在从这里读取静态资产。显然,.war 仅通过重建重新部署进行更新。
如何让 Jetty 直接从我的工作区加载静态内容?
谢谢
I'm running Jetty from within Eclipse, installed with the Jetty Server Adaptor. I'm building a Tapestry app, and live class reloading works great. However, changes to static assets, such as images and css are not being instantly reflected: I have to do a Jetty restart-rebuild-redeploy, which is quite slow.
I think the reason for this is that my app is being deployed as a .war, and Jetty is reading static assets from here. Obviously the .war is only updated with a rebuild-redeploy.
How can I get Jetty to load static content directly from my workspace?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用当前版本的 Jetty eclipse WTP 插件可能无法部署爆发战争,至少根据 此未完成的功能请求。
另一种解决方案是手动运行 Jetty 这将允许您部署分解的 Web 应用程序,而不是通过 Eclipse WTP。尽管您需要编写一个脚本,以便在 Eclipse 项目的源文件夹中的静态资源发生更改时将其复制到部署目录。
It might not be possible to deploy an exploded war using the current version of the Jetty eclipse WTP plugin, at least according to this outstanding feature request.
An alternative solution would be to run Jetty manually instead of through Eclipse WTP, this would allow you to deploy the web app exploded. Although you'd need to hack a script together to copy static resources to the deployment directory as and when they change in the source folder in your eclipse project.
将 Jetty 的
webdefault.xml
中名为useFileMappedBuffer
的参数调整为false
应该可以防止在从 Eclipse 运行 Jetty 时锁定静态文件。Adjusting a parameter in Jetty's
webdefault.xml
nameduseFileMappedBuffer
to befalse
should prevent locking of static files when running Jetty from Eclipse.