当在play控制台发出“run”命令时,如何更改开发模式下play框架使用的默认端口。

这是playframework 2.0测试版。

使用http。端口配置参数在命令行或在application.conf中似乎没有影响:

C:\dev\prototype\activiti-preso>play run --http.port=8080
[info] Loading project definition from C:\dev\prototype\activiti-preso\project
[info] Set current project to activiti-preso (in build file:/C:/dev/prototype/activiti-preso/)


Windows, really? Ok, disabling colors.

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

[error] org.jboss.netty.channel.ChannelException: Failed to bind to: 0.0.0.0/0.0.0.0:9000
[error] Use 'last' for the full log.

当前回答

使用2.3.7 Play框架测试。工作得很好。

./{application}/bin/{executable} -Dhttp.port=5000

其他回答

在Windows上,“运行9001”可能无法运行。你必须改变play.bat文件。看到机票

我们不能从激活器更改应用程序端口,但可以从命令行激活器“~run 8080”更改。

但是要从激活器上运行poet 9000,我们需要停止正在使用该端口的应用程序。我们可以使用this应用程序来查找并结束该过程https://technet.microsoft.com/en-in/sysinternals/bb897437.aspx

在此之后,我们可以运行,它将成功。

只需在build.sbt中添加以下行

PlayKeys.devSettings:= Seq("play.server.http. play. devsettings . "端口" -> "8080")

使用2.3.7 Play框架测试。工作得很好。

./{application}/bin/{executable} -Dhttp.port=5000

希望这能帮助到一些人。

通过SBT设置:

...
.settings(PlayKeys.playDefaultPort := 8855)
...