简体   繁体   English

如何在Scala项目中运行sbt-revolver?

[英]How to run sbt-revolver with a Scala project?

So I'm reading the documentation for sbt-revolver since I'm interest in using its: 所以我正在阅读sbt-revolver的文档,因为我对使用它感兴趣:

Triggered restart: automatically restart your application as soon as some of its sources have been changed 触发重新启动:更改某些应用程序的源之后,将自动重新启动您的应用程序

It says in the documentation that it should work with any scala project ( I'm running an Akka Http) as long as it has a class with a main method and that we just need to plug in project/plugins.sbt : 它在文档中说,它应该与任何scala项目(我正在运行Akka Http)一起使用,只要它具有带有main方法的类,并且我们只需要插入project/plugins.sbt

addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.0")

So I did that then I went with terminal to root folder, ran sbt wait it to load and then run , now I made a small change in some file that loads and html with some <h1> but changes aren't reloaded, what am I missing? 所以我做到了,然后我将终端转到根文件夹,运行sbt等待其加载然后run ,现在我在加载的某些文件中做了一些小的更改,并用<h1> html更改,但是更改没有重新加载,这是什么我想念吗?

Update 更新

So after running sbt in terminal, then I run ~reStart and it seems to exit the server: 所以运行后sbt在终端,然后我跑~reStart ,它似乎退出服务器:

root Server online at localhost:8080 root Press RETURN to stop... root ... 
finished with exit code 0  

You have two options, if you need only run , no need the revolver plugin, just start it with 您有两个选择,如果只需要run ,不需要左轮手枪插件,只需使用以下命令启动

~run

If you need revolver, you should use 如果需要左轮手枪,应该使用

~reStart

as it is stated on their homepage too: 正如他们的首页上所述:

You can use ~reStart to go into "triggered restart" mode. 您可以使用~reStart进入“触发重启”模式。 Your application starts up and SBT watches for changes in your source (or resource) files. 您的应用程序启动,SBT监视源(或资源)文件中的更改。 If a change is detected SBT recompiles the required classes and sbt-revolver automatically restarts your application. 如果检测到更改,SBT将重新编译所需的类,并且sbt-revolver会自动重新启动您的应用程序。

Note, you can specify any command to be run on each change of source files after ~ . 注意,您可以在~之后指定对源文件的每次更改都要运行的任何命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM