执行“运行"命令时,如何更改Play使用的默认端口(9000).命令? [英] How do I change the default port (9000) that Play uses when I execute the "run" command?

查看:118
本文介绍了执行“运行"命令时,如何更改Play使用的默认端口(9000).命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在播放控制台上发出运行"命令时,如何更改开发框架在开发模式下使用的默认端口.

How can I change the default port used by the play framework in development mode when issueing the "run" command on the play console.

这是针对playframework 2.0 beta版的.

This is for playframework 2.0 beta.

在命令行或application.conf中使用http.port配置参数似乎无效:

Using the http.port configuration parameter either on the command line or in the application.conf seems to have no effect:

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.x

在Play 2中,这些是通过sbt插件实现的,因此以下说明实际上只是sbt任务.您可以使用任何sbt运行程序(e 在Play 2中,这些是通过sbt插件实现的,因此以下内容实际上只是 sbt任务.您可以使用任何sbt运行程序(例如sbtplayactivator).在sbt下使用转轮,但是 您可以用它代替您选择的sbt运行程序.

In Play 2, these are implemented with an sbt plugin, so the following instructions are really just sbt tasks. You can use any sbt runner (e In Play 2, these are implemented with an sbt plugin, so the following are really just sbt tasks. You can use any sbt runner (e.g. sbt, play, or activator). Below the sbt runner is used, but you can substitute it for your sbt runner of choice.

播放2.x-开发模式

对于浏览器重新加载模式:

Play 2.x - Dev Mode

For browser-reload mode:

sbt "run 8080"

对于连续重载模式:

sbt "~run 8080"

播放2.x-调试模式

要使用端口8080上的http侦听器以调试模式运行,请运行:

Play 2.x - Debug Mode

To run in debug mode with the http listener on port 8080, run:

sbt -jvm-debug 9999 "run 8080"

播放2.x-产品模式

以生产模式启动:

Play 2.x - Prod Mode

Start in Prod mode:

sbt "start -Dhttp.port=8080"

播放2.x-分阶段分发

创建分段分发:

Play 2.x - Staged Distribution

Create a staged distribution:

sbt stage

对于Play 2.0.x和2.1.x,请使用target/start脚本(仅限Unix):

For Play 2.0.x and 2.1.x use the target/start script (Unix Only):

target/start -Dhttp.port=8080

对于Play 2.2.x& 2.3.x在target/universal/stage/bin目录中使用适当的启动脚本:

For Play 2.2.x & 2.3.x use the appropriate start script in the target/universal/stage/bin directory:

target/universal/stage/bin/[appname] -Dhttp.port=8080

使用Play 2.2.x&在Windows上为2.3.x:

With Play 2.2.x & 2.3.x on Windows:

target\universal\stage\bin\[appname].bat -Dhttp.port=8080

播放2.x-邮政编码分布

要创建zip发行版,请执行以下操作:

Play 2.x - Zip Distribution

To create a zip distribution:

sbt dist

对于Play 2.0.x和2.1.x,请在提取的zip中使用start脚本(仅限Unix):

For Play 2.0.x and 2.1.x use the start script (Unix Only) in the extracted zip:

start -Dhttp.port=8080

对于Play 2.2.x,请使用[appname]-[version]/bin目录中的相应脚本:

For Play 2.2.x use the appropriate script in the [appname]-[version]/bin directory:

[appname]-[version]/bin/[appname] -Dhttp.port=8080

在Windows上使用Play 2.2.x:

With Play 2.2.x on Windows:

[appname]-[version]\bin\[appname].bat -Dhttp.port=8080

播放1.x

更改conf/application.conf文件中的http.port值或将其传递给命令行:

Play 1.x

Change the http.port value in the conf/application.conf file or pass it command line:

play run --http.port=8080

这篇关于执行“运行"命令时,如何更改Play使用的默认端口(9000).命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆