创建一个运行程序的新任务 [英] Create a new task that runs a program

查看:42
本文介绍了创建一个运行程序的新任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要定义一个自定义任务来计算主类的名称然后运行它.我在想这样的事情

I need to define a custom tasks that computes the name of a main class and then runs it. I was thinking about something like this

customTask {
  mainClass = compute main class name based on env
  runMain(mainClass, jvm-args, fork=true)
}

然后在 SBT 中我将能够运行

and then in SBT i would be able to run

sbt> 自定义任务

这可以在 SBT 11.2 中完成吗?.

can this be done in SBT 11.2 ?.

推荐答案

好吧,你可以试一试.. 我很好 -

well you can give it a try .. I works fine for me -

lazy val testngRun = inputKey[Unit]("custom run task for testng")

testngRun := {
    val one = (runMain in Compile).fullInput(" org.testng.TestNG -testclass com.pg.acceptance.testcase.PfsLoginServiceTest").evaluated
}

这篇关于创建一个运行程序的新任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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