[Stack Overflow] 怎样在用run命令运行Play的时候改变默认端口(9000)
原文:http://stackoverflow.com/questions/8205067/how-do-i-change-the-default-port-9000-that-play-uses-when-i-execute-the-run
当我在Play控制台用“run”命令运行play framework 调试模式的时候,通过什么方法可以改变默认的端口呢?
下面这个是针对Play 2.0测试版的。
在命令行里使用http.port参数设置和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.
playframework port playframework-2.0share|improve this questionedited Nov 21 '11 at 7:40在 conf/application.conf
里改变 http.port
的值或者在命令行里这样:
play run --http.port=8080
当使用Play命令运行的时候:
play "run 8080"
当使用sbt命令运行的时候:
sbt stagetarget/start -Dhttp.port=8080
很抱歉生成的启动脚本仅针对 Linux & Mac。所以如果你需要在Windows里完成,请查看 target/start
并把他改成相应的Windwos命令。相信我,不会很难的。
play run 8080
it still runs on 9000. I'm on a Mac. What gives? EDIT:play "run 8080"
works! – Jay Q. Mar 27 '12 at 7:11show 1 more comment