Reload app on custom file change in playframework

白昼怎懂夜的黑 提交于 2019-12-30 09:10:07

问题


In playframework there is auto-reload feature. It means that in development mode on each request play checks files on changes, and recompiles and reloads project if necessary. So, for example if I $ touch conf/routes, project will be reloaded on next request.

I'd like to add some custom file to watch for.

I believe watchSources setting contains list of files play is watching for. But it doesn't work for me. Consider, we want to add trigger file to watched sources.

watchSources <+= baseDirectory map { _ / "trigger" }

It is successfully added to watch sources

[sbt console] $ show watch-sources
[info] List(/* trigger appears in list */)

But play ignores trigger changes and doesn't restart application. What I am missing? How to make play watch for custom file changes?


回答1:


I've never tried to do this, but after investigating, I noticed that

watchSources <+= confDirectory map { _ / "routes" }

naturally points to the routes file in conf (conf/routes). Is it possible you forgot to put the file "trigger" in conf (conf/trigger)?



来源:https://stackoverflow.com/questions/10226919/reload-app-on-custom-file-change-in-playframework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!