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

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

问题描述

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

这是针对 playframework 2.0 测试版.

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

C:devprototypeactiviti-preso>play run --http.port=8080[信息] 从 C:devprototypeactiviti-presoproject 加载项目定义[信息] 将当前项目设置为 activiti-preso(在构建文件中:/C:/dev/prototype/activiti-preso/)窗户,真的吗?好的,禁用颜色.---(从 SBT 运行应用程序,启用自动重新加载)---[错误] org.jboss.netty.channel.ChannelException:无法绑定到:0.0.0.0/0.0.0.0:9000[错误] 对完整日志使用last".

解决方案

Play 2.x

<块引用>

在 Play 2 中,这些是通过 sbt 插件实现的,因此以下说明实际上只是 sbt 任务.您可以使用任何 sbt runner (e在 Play 2 中,这些是通过 sbt 插件实现的,所以以下只是sbt 任务.您可以使用任何 sbt runner(例如 sbtplay激活器).在 sbt 运行器下方使用,但你可以用它代替你选择的 sbt runner.

玩 2.x - 开发模式

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

sbt "运行 8080"

对于连续重新加载模式:

sbt "~run 8080"

播放 2.x - 调试模式

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

sbt -jvm-debug 9999 "run 8080"

Play 2.x - Prod 模式

以生产模式开始:

sbt "start -Dhttp.port=8080"

Play 2.x - 分阶段分发

创建分阶段分发:

sbt 阶段

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

target/start -Dhttp.port=8080

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

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

随着 Play 2.2.x &Windows 上的 2.3.x:

targetuniversalstagein[appname].bat -Dhttp.port=8080

播放 2.x - Zip 分发

要创建一个 zip 分发包:

sbt dist

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

start -Dhttp.port=8080

对于 Play 2.2.x,在 [appname]-[version]/bin 目录中使用适当的脚本:

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

在 Windows 上使用 Play 2.2.x:

[appname]-[version]in[appname].bat -Dhttp.port=8080

播放 1.x

更改 conf/application.conf 文件中的 http.port 值或通过命令行:

play run --http.port=8080

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

This is for playframework 2.0 beta.

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

C:devprototypeactiviti-preso>play run --http.port=8080
[info] Loading project definition from C:devprototypeactiviti-presoproject
[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.

解决方案

Play 2.x

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.

Play 2.x - Dev Mode

For browser-reload mode:

sbt "run 8080"

For continuous-reload mode:

sbt "~run 8080"

Play 2.x - Debug Mode

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

sbt -jvm-debug 9999 "run 8080"

Play 2.x - Prod Mode

Start in Prod mode:

sbt "start -Dhttp.port=8080"

Play 2.x - Staged Distribution

Create a staged distribution:

sbt stage

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

target/start -Dhttp.port=8080

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

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

targetuniversalstagein[appname].bat -Dhttp.port=8080

Play 2.x - Zip Distribution

To create a zip distribution:

sbt dist

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

start -Dhttp.port=8080

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

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

With Play 2.2.x on Windows:

[appname]-[version]in[appname].bat -Dhttp.port=8080

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天全站免登陆