在Playframework中更改自定义文件后重新加载应用 [英] Reload app on custom file change in playframework

查看:84
本文介绍了在Playframework中更改自定义文件后重新加载应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在播放框架中,具有自动重新加载功能.这意味着在开发模式下,每个请求播放都会检查文件中的更改,并在必要时重新编译并重新加载项目.因此,例如,如果我$ touch conf/routes,则在下一个请求时将重新加载项目.

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.

我相信 watchSources 设置包含正在播放的文件列表.但这对我不起作用.考虑一下,我们想将trigger文件添加到受监视的源中.

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" }

已成功添加到观看源

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

但是播放会忽略trigger的更改,并且不会重新启动应用程序.我想念的是什么?如何让播放监视自定义文件的更改?

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

推荐答案

我从未尝试过这样做,但是经过调查,我注意到了

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

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

自然地指向conf(conf/routes)中的路由文件.您是否有可能忘记将文件"trigger"放入conf(conf/trigger)中?

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

这篇关于在Playframework中更改自定义文件后重新加载应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆