问题描述
问题:
- 正在编译视图但是在浏览器中点击刷新将不会显示更改手动重启服务器。
- 对控制器的更改使用
~run
自动编译,但只有手动重启服务器才会更新服务器上的内容。 - 只有在手动重启服务器后才会显示
conf
下routes
的更改。
- Views are being compiled but hitting refresh in a browser won't show the changes without restarting the server manually.
- Changes to controllers compile automatically using
~run
but only a manual server restart will update the content on the server. - Changes to
routes
underconf
are only shown after manually restarting the server.
背景:
- 在OSX 10.8.3上运行
- 使用Eclipse Juno 4.2.2
- 服务器使用
play~run $启动c $ c>
- 仅重启服务器会显示视图,控制器,路线的变化
- running on OSX 10.8.3
- using Eclipse Juno 4.2.2
- Server is launched using
play ~run
- Only restarting the server will show changes to views, controllers, routes
为了能够在每次尝试时不必重启服务器而进行更改(没有成功):
To be able to make changes without having to restart the server each time I tried (without success):
- 控制台中的
- :
clean
- >eclipse
- >〜在控制台中运行
- :
clean
- >compile
- >〜运行
- 关闭/重新启动计算机
- 勾选
参考使用本机挂钩或轮询
- >从引用库
中删除classes_managed
并手动添加
- in the console:
clean
->eclipse
->~run
- in the console:
clean
->compile
->~run
- shutdown/restart the computer
- Tick
Refresh using native hooks or polling
-> removeclasses_managed
fromReferenced Libraries
and add it manually
问题:
- 如何恢复自动重新加载功能?
- 如何在除Eclipse之外的IDE上解决此问题?
- How can the Auto-Reload functionality be restored?
- How can this problem be solved on IDEs besides Eclipse?
更多信息:
- Playframework reload not working Mac OSX
- Auto-reloading with Play framework on a network filesystem
它们都指向JNotify作为自动重新加载无法工作的原因。其中一个答案(没有足够的代表撰写评论)提到了如何破解Play框架的sbt插件以使PlayReloader特性表现得好像JNotify不可用。怎么可以实现这个?
Both of them point to JNotify as the cause for auto-reloading not to work. One of the answers (not enough rep to write a comment) mentions how one could "hack Play framework's sbt plugin to make the PlayReloader trait behave as if JNotify wasn't available." How could one achieve this?
推荐答案
以下让Play自动重新加载到Eclipse:
The following got Play's auto-reload to working with Eclipse:
- 在Eclipse首选项中,转到
常规
→工作区
。取消选中自动构建
。 - 重新启动OS X.
- In Eclipse Preferences go to
General
→Workspace
. UncheckBuild automatically
. - Restart OS X.
无论出于何种原因,我不得不重新启动OS X以获得akim的建议。
For whatever reason, I had to restart OS X to get akim's suggestion to take hold.
这篇关于Play Framework 2.1 Java / Eclipse:自动重新加载不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!