问题
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