Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new task that runs a program

Tags:

scala

sbt

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)
}

and then in SBT i would be able to run

sbt> custom-task

can this be done in SBT 11.2 ?.

like image 930
Lars Tackmann Avatar asked Mar 14 '12 13:03

Lars Tackmann


1 Answers

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
}
like image 111
vishal Avatar answered Oct 31 '22 23:10

vishal