使用 SBT 任务自动停止服务器在 IntelliJ IDEA 中运行 PLay Framework 2.x

问题描述 投票:0回答:1

我尝试在 IntelliJ IDEA 中运行 Play 项目。我关注这个文档

这是我的配置。 api是我的子项目enter image description here

但是当我点击运行图标时,我的服务立即成功启动

AkkaHttpServer - Stopping server
。然后我在
sbt shell
中输入 api/run,我的服务启动成功并正常工作。仅当我检查配置中的User sbt shell时才会发生此问题

这是我在 sbt shell 中的登录

"C:\Program Files\Java\jdk1.8.0_251\bin\java.exe" -server -Xmx1536M -Dsbt.supershell=false -Didea.managed=true -Dfile.encoding=UTF-8 -Dsbt.version=1.3.8 -Dsbt.log.noformat=true -jar C:\Users\LAP13556-local\AppData\Roaming\JetBrains\IntelliJIdea2020.1\plugins\Scala\launcher\sbt-launch.jar early(addPluginSbtFile=\"\"\"C:\Users\LAP13556-local\AppData\Local\Temp\idea979.sbt\"\"\") "; set ideaPort in Global := 51722 ; idea-shell"
[info] Loading global plugins from C:\Users\LAP13556-local\.sbt\1.0\plugins
[info] Loading settings for project crm-server-build from plugins.sbt,idea979.sbt ...
[info] Loading project definition from C:\Users\...\crm-server\project
[info] Loading settings for project crm-server from build.sbt ...
[info] Set current project to crm-server (in build file:/C:/Users/.../crm-server/)
[info] Defining Global / ideaPort
[info] The new value will be used by Compile / compile, Test / compile and 3 others.
[info]  Run `last` for details.
[info] Reapplying settings...
[info] Set current project to crm-server (in build file:/C:/Users/.../crm-server/)
[IJ]sbt:crm-server> api/run

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

[info] p.c.s.AkkaHttpServer - Stopping server...

[success] Total time: 26 s, completed Jul 31, 2020 9:26:28 AM

[IJ]sbt:crm-server> api/run // I type this command

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

谁能告诉我原因。谢谢。

intellij-idea playframework sbt
1个回答
0
投票

在任务输入中,而不是

api/run

使用

api/~run

而且它不会再停止了!

我自己正在使用

"project webapp" "~run 8080"

工作起来就像一个魅力,也可以调试!

© www.soinside.com 2019 - 2024. All rights reserved.