【发布时间】:2020-03-27 10:04:24
【问题描述】:
我一直在使用已弃用的 SBT Activator 包装器运行我的 Play 项目,它允许我为它启动的 JVM 指定 -D 选项,如下所示:
> activator -Dhttp.port=9000 -Dplay.server.websocket.frame.maxLength=10485760 "run 9000"
这非常有用,因为它允许我创建单独的 .bat 文件以在不同端口上运行给定项目,这非常好,因为我正在并行处理多个不同的网站。
但是,我无法将此命令行转换为直接使用 SBT:
> sbt -Dhttp.port=9000 -Dplay.server.websocket.frame.maxLength=10485760 "run 9000"
...
[error] Expected letter
[error] Expected symbol
[error] Expected '+'
[error] Expected '++'
[error] Expected 'java++'
[error] Expected 'java+'
[error] Expected '^'
[error] Expected '^^'
[error] Expected '+-'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected 'addPluginSbtFile'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected 'Global'
[error] Expected '*'
[error] Expected 'Zero'
[error] Expected 'ThisBuild'
[error] Expected 'ProjectRef('
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected configuration ident
[error] Expected key
[error] Expected end of input.
[error] Expected ';'
[error] Expected 'early('
[error] Expected '-'
[error] Expected '--'
[error] Expected '!'
[error] .port
[error] ^
按照https://stackoverflow.com/a/47914062/708381的建议添加-J
> sbt -J-Dhttp.port=9000 -J-Dplay.server.websocket.frame.maxLength=10485760 "run 9000"
...
[error] Expected symbol
[error] Not a valid command: -
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected 'addPluginSbtFile'
[error] -J-Dhttp
[error] ^
SBT 文档列出了许多属性(所有这些属性都包含点),但未能提供任何完整的命令行示例来说明如何实际指定它们。似乎您应该能够像我的第一个示例一样“只”执行 -Dprop=value :https://www.scala-sbt.org/1.x/docs/Command-Line-Reference.html
(是的,有更多最新版本的 SBT 可用,但我被这个错误阻止了:https://github.com/sbt/sbt/issues/5046 - 理想情况下,任何解决方案都适用于任何最新版本的 SBT)
【问题讨论】:
-
我也试过
sbt -D"http.port=9000" -D"play.server.websocket.frame.maxLength=10485760" "run 9000"和sbt "-Dhttp.port=9000" "-Dplay.server.websocket.frame.maxLength=10485760" "run 9000"无济于事。 -
run -Dhttp.port=1234说playframework.com/documentation/2.7.x/…
标签: java scala sbt playback typesafe-activator