sbt中是否存在gradle的JavaExec
任务?这是文档中的示例,用于了解我在寻找什么:
apply plugin: 'java'
task runApp(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'package.Main'
// arguments to pass to the application
args 'appArg1'
}
我需要配置类路径,main并传递一些args-如本例所示。
答案 0 :(得分:3)
runner
类似于gradle的JavaExec
val runApp = taskKey[Unit]("sbt equivalent of gradle's JavaExec")
runApp := {
(runner in Compile).value.run(
mainClass = "example.Main",
classpath = (fullClasspath in Runtime).value.files,
options = Array("appArg1"),
log = streams.value.log
)
}