SBT:启动非默认项目主类的命令行“运行" [英] SBT: Start a command line 'run' of the main class of a non-default project
问题描述
我开始使用 sbt 构建我的 Scala 代码(并处理依赖项).据我所知,如果我使用
I am starting to use sbt build my Scala code (and handle dependencies). As far as I know if I use
$ sbt run <args>
在命令行上,这将运行主项目的主类.
on the command line this will run the main class of the main project.
是否可以从命令行在任何其他项目中运行",即不在交互式会话模式下?(我正在考虑类似于 $ sbt project <proj> run <args>
或其他类似的东西...)
Is it possible to 'run' within any other project from the command line, i.e. not in the interactive session mode? (I'm thinking about something that might look like $ sbt project <proj> run <args>
or whatever...)
我在交互模式下会做的是:
What I would do in interactive mode is this:
$ sbt
> project <projectname>
> run <args>
这似乎很简单,但我找不到任何描述这种行为的文档.提示将不胜感激...
This seems to be straightforward enough, but I can not find any documentation describing this behavior. Hints would be much appreciated...
推荐答案
您只需引用每个命令(如第二个示例 在这个页面上),所以在你的情况下是:
You simply have to quote each command (as in the second example on this page), so in your case it would be:
$ sbt "project foo" "run arg1 arg2"
这篇关于SBT:启动非默认项目主类的命令行“运行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!