使用 SBT 启动应用任务/批次? [英] Use SBT to launch an applicative task/batch?
问题描述
可以使用 SBT 来启动应用程序 Scala 批次吗?
Can SBT be used to launch applicative Scala batches?
我的意思是,例如一个 Scala 应用代码,它会减少所有用户的余额.
I mean, a Scala applicative code that would decrement all the user's balance for exemple.
我可以想象一个特殊的 SBT 项目,它具有对应用代码的构建依赖性,以便项目的某些 SBT 任务可以启动此应用代码.
I can imagine a special SBT project for that with a build dependency on the applicative code, so that some SBT tasks of the project can launch this applicative code.
你会做这种事吗?为什么?
Would you do such a thing? Why?
在 Scala 中简化应用批次启动的替代方法是什么?在 Maven 中,我曾经使用 appassembler 插件来生成 sh 脚本和所有与类路径相关的东西.
What are the alternatives to ease the launch of applicative batches in Scala? With Maven I used to use the appassembler plugin which would generate sh scripts and all the classpath related stuff.
推荐答案
一个简单的方法是使用 sbt run
.
A simple way is to use sbt run
.
object Main {
def main(args: Array[String]) {
// decrement all user balances.
};
};
然后 sbt run
从 shell、jenkins 等
Then sbt run
from shell, jenkins, etc.
使用命令行参数扩展功能.
Use command line args to expand the functionality.
这篇关于使用 SBT 启动应用任务/批次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!