mjs*_*sen 11 config sbt playframework
我有我认为是开发和部署Play 2.3.6应用程序的常见用例:
sbt run并且应用程序application.conf按预期使用.sbt start并指定配置文件production.conf,它与dev配置文件位于同一目录中(即<project root>/conf/)按照官方文档页面上"指定备用配置文件"标题下的说明进行操作,如下所示:
$ sbt start -Dconfig.file=/full/path/to/project/conf/production.conf
Run Code Online (Sandbox Code Playgroud)
应用程序启动时没有错误,但我可以检查Web应用程序并看到它正在加载我的application.conf开发值,而不是我的生产值production.conf.
我也尝试了建议的方法:
$ sbt start -Dconfig.resource=production.conf
Run Code Online (Sandbox Code Playgroud)
并且服务器无法启动时出现错误:
[error] com.typesafe.config.ConfigException$IO: production.conf: java.io.IOException: resource not found on classpath: production.conf
Run Code Online (Sandbox Code Playgroud)
有没有其他人想出如何正确地做到这一点?
mjs*_*sen 29
经过几个小时的浪费,我想通了.使用如下引号正确传递参数:
$ sbt "start -Dconfig.resource=production.conf"
Run Code Online (Sandbox Code Playgroud)
另外,如果你需要指定端口号,确保谈到之后的配置选项,否则将被忽略:
$ sbt "start -Dconfig.resource=production.conf 9001"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7203 次 |
| 最近记录: |