2016-04-08 47 views

回答

1

這可以通過設置playDefaultPort key來完成,如下所示:

import PlayKeys._ 
playDefaultPort := 9123 

之後,您就可以runtestProd無需記住所需的端口。

這個工作在兩種發展:

$ sbt run 
[info] Loading project definition from /Users/michaelahlers/Projects/MyApp/project 
[info] Set current project to MyApp (in build file:/Users/michaelahlers/Projects/MyApp/) 

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

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9123 

(Server started, use Ctrl+D to stop and go back to the console...) 

和生產模式:

$ sbt testProd 
[info] Loading project definition from /Users/michaelahlers/Projects/MyApp/project 
[info] Set current project to MyApp (in build file:/Users/michaelahlers/Projects/MyApp/) 
[info] Packaging /Users/michaelahlers/Projects/MyApp/target/scala-2.11/MyApp_2.11-1.0.0-SNAPSHOT-web-assets.jar ... 
[info] Done packaging. 

(Starting server. Type Ctrl+D to exit logs, the server will remain in background) 

2016-04-08 13:09:45,594 [info] a.e.s.Slf4jLogger - Slf4jLogger started 
2016-04-08 13:09:45,655 [info] play.api.Play - Application started (Prod) 
2016-04-08 13:09:45,767 [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9123