Playframework 2.0 如何更改play framework 2.4.1的http端口?

Playframework 2.0 如何更改play framework 2.4.1的http端口?,playframework-2.0,Playframework 2.0,我来自Play1.2.7应用程序,目前正在开始使用PlayFramework2.4.1和scala。首先,我使用ActivatorWebUI来管理应用程序,但在那里我无法让应用程序使用不同的http端口 我更改了conf/application.conf中的http.port设置,但play 2.4.1仍尝试绑定到已经在使用的端口9000。我尝试的设置是: http.port=7000 对于如何更改通过activator web ui运行的play framework 2.4.1应用程序的端口

我来自Play1.2.7应用程序,目前正在开始使用PlayFramework2.4.1和scala。首先,我使用ActivatorWebUI来管理应用程序,但在那里我无法让应用程序使用不同的http端口

我更改了conf/application.conf中的http.port设置,但play 2.4.1仍尝试绑定到已经在使用的端口9000。我尝试的设置是:

http.port=7000
对于如何更改通过activator web ui运行的play framework 2.4.1应用程序的端口,有何建议

请注意,正如链接问题中所建议的,我可以使用

./activator "run 7000"

在应用程序本身中,将其绑定到端口7000。我的问题仍然是如何通过activator web ui获得相同的行为?

将以下内容添加到项目的build.sbt中,其中
应替换为所需的端口号

build.sbt

fork in run := true
javaOptions in run += "-Dhttp.port=<port>"
运行中的fork:=true
运行时的javaOptions+=“-Dhttp.port=”
运行时Activator UI中预期的控制台输出

Setting up Play fork run ... (use Ctrl+D to cancel)

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

p.a.l.c.ActorSystemProvider - Starting application default Akka system: application
p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:<port>

(Server started, use Ctrl+D to stop and go back to the console...)
设置Play fork运行。。。(使用Ctrl+D取消)
---(运行应用程序时,启用自动重新加载)---
p、 a.l.c.ActorSystemProvider-启动应用程序默认Akka系统:应用程序
p、 c.s.NettyServer-在/0:0:0:0:0:0:0:0:0上侦听HTTP:
(服务器已启动,使用Ctrl+D停止并返回控制台…)

通过生产中的
应用程序.conf

play.server.http.port = 80
使用SBT运行应用程序时:

PlayKeys.devSettings := Seq("play.server.http.port" -> "80")
使用
run
命令:

$ run 80
有关更多详细信息,请参阅以下链接:


关于
运行
命令(使用Play!2.4测试)的简短说明:

至少在Windows上,activator运行-Dhttp.port=80不起作用,但
activator
(按回车键),然后运行-Dhttp.port=80works

尝试以下操作:

activator "run 9500"

在项目文件夹的终端中。

此命令适用于我:

activator "~run 3333"

可能是重复的,我遵循文档并将http.port添加到application.conf,但似乎没有使用它。我现在不使用play-run方法,而是使用activator的web ui。我尝试过这样做,但没有效果。我尝试过用activator和sbt启动它,但都没有选择此解决方案。此解决方案仅用于通过activator Web UI(
activator UI
)启动应用程序。如果您想在使用sbt或activator命令行时更改端口,只需将
-Dhttp.port=
添加到您的命令中(例如
activator run-Dhttp.port=8080
),回答问题永远不会太迟!将参数传递给activator(或sbt)时,必须使用引号:
activator“run-Dhttp.port=80”
,否则每个参数都假定为一个任务并单独运行。运行activator(或sbt)控制台时,可以省略引号。