使用“sbt run"设置系统属性 [英] Setting system properties with "sbt run"

查看:59
本文介绍了使用“sbt run"设置系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新版本的 SBT(似乎很难弄清楚版本是什么).我想使用 sbt run 将系统属性传递给我的应用程序,如下所示:

I'm using a pretty recent version of SBT (seems to be hard to figure out what the version is). I want to pass system properties to my application with sbt run as follows:

sbt -Dmyprop=x run

我怎么能这样做?

推荐答案

SBT 的运行程序通常不会创建新进程,因此如果您想设置传递的参数,您还必须告诉它这样做.您可以将这样的内容添加到您的构建设置中:

SBT's runner doesn't normally create new processes, so you also have to tell it to do this if you want to set the arguments that are passed. You can add something like this to your build settings:

fork := true

javaOptions := Seq("-Dmx=1024M")

SBT 文档中提供了有关分叉流程的更多详细信息.

这篇关于使用“sbt run"设置系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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