SBT:从命令行运行特定的主方法
我有几种用@main
注释的方法,即使在彻底查看了SBT文档之后,它也完全击败了我如何从终端运行其中一种方法。我只能找到如何指定主要类中的源文件。但是,我的项目仅包含一个文件,因此这并不是很有帮助。
假设我有以下内容(当然是项目的根目录):
├── root
│ └── src
│ └── main
│ └── scala
│ └── main.scala
main.scala
看起来像这样:
object main:
@main def foo(): Unit = ???
@main def bar(): Unit = ???
是运行foo
或<的唯一方法代码> bar 从外壳中以通过几个文件分发我的方法?
I have several methods annotated with @main
and it totally beats me how to run one of them specifically from a terminal, even after thoroughly looking at the sbt documentation. All I can find is how to specify what source file my main class is in. My project contains only one file though, so this is not really helpful.
Assume I have the following (where root being the project's root directory of course):
├── root
│ └── src
│ └── main
│ └── scala
│ └── main.scala
and main.scala
looks something like this:
object main:
@main def foo(): Unit = ???
@main def bar(): Unit = ???
Is the only way to run either foo
or bar
from a shell to distribute up my methods over several files? ????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过以下方式从 SBT shell 内部运行任一方法:
或
You may run either methods from inside SBT shell via:
or