读书人

[Stack Overflow] 怎的在用run命令运

发布时间: 2013-03-21 10:08:17 作者: rapoo

[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


21down votefavorite5

当我在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
asked Nov 20 '11 at 21:56[Stack Overflow] 怎的在用run命令运行Play的时候改变默认端口(9000)Boris Terzic
5,03442247 10 +1 for the "Windows, really? Ok, disabling colors." output. It may not be yours, but it's still hilarious :D Pere Villega Nov 21 '11 at 8:32

7 回答activeoldestvotesup vote52down voteaccepted

Play 1.x

conf/application.conf 里改变 http.port 的值或者在命令行里这样:

play run --http.port=8080

Play 2.0

当使用Play命令运行的时候:

play "run 8080"

当使用sbt命令运行的时候:

sbt stagetarget/start -Dhttp.port=8080

很抱歉生成的启动脚本仅针对 Linux & Mac。所以如果你需要在Windows里完成,请查看 target/start 并把他改成相应的Windwos命令。相信我,不会很难的。

share|improve this answeredited Mar 30 '12 at 16:02[Stack Overflow] 怎的在用run命令运行Play的时候改变默认端口(9000)Nick
4,4141326answered Nov 21 '11 at 2:49[Stack Overflow] 怎的在用run命令运行Play的时候改变默认端口(9000)James Ward
11.3k31833 Interestingly enough that doesn't actually work. But perhaps that is just a bug or an issue with my system. Boris Terzic Nov 21 '11 at 7:37 I believe right now this is only for 1.x, not yet implemented in 2.0 beta Pere Villega Nov 21 '11 at 8:31 Whoops. Sorry. I missed the 2.0 part. James Ward Nov 21 '11 at 12:21 Added instructions for Play 2. James Ward Nov 21 '11 at 23:451 I'm running Play 2.0. When i try 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

读书人网 >软件架构设计

热点推荐