`activator ~ run` doesn't work

2019-03-02 19:08发布

When running activator ~ run, here is what happens:

  1. When the dev server first runs, I get a message in the console saying that the server is listening on port 9000.
  2. Now, when I make changes to the files and save, nothing is outputted to the console.
  3. When I refresh the page, however, I see a message about reload in the console, and the browser loads.

I thought ~ run meant re-run at every file change?

3条回答
手持菜刀,她持情操
2楼-- · 2019-03-02 19:12

According to Play Docs:

Tip: You can run your application using ~run to enable direct compilation on file change. This way scala template files are auto discovered when you create a new template in view and auto compiled when the file changes. If you use normal run then you have to hit Refresh on your browser each time.

So it apparently only applies to Scala template files.

EDIT

Ryan is right, just tested it and it works also for Scala files.

Since it does not work at all with the whitespace between "~" and "run" I suppose that's not a problem as well (you quoted it with whitespace).

查看更多
做个烂人
3楼-- · 2019-03-02 19:23

Open your build.sbt file and check if it contains line like fork in run := true in it. If it does, delete the line or set the value to false.

Why is that?

this fork is required by Activator UI to spawn the processes, so every time, when you are starting your app from UI, it adds the line first to make sure that will exist. Anyway it causes some problems with hot reload (and also some other weird things, like app hanging, memory leaks).

查看更多
ら.Afraid
4楼-- · 2019-03-02 19:30

Have you tried starting the console first by typing

activator

Then after the console is up you could type

[your-app] $ ~run

Usually, whenever any files changed/added. It will trigger compilation process.

查看更多
登录 后发表回答