Create a new task that runs a program

前端 未结 2 599
梦如初夏
梦如初夏 2021-01-12 04:06

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 =          


        
相关标签:
2条回答
  • 2021-01-12 04:15

    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
    }
    
    0 讨论(0)
  • 2021-01-12 04:19

    Late answer but you can create new SBT tasks as mentioned in documentation http://www.scala-sbt.org/release/docs/Detailed-Topics/Tasks#defining-a-new-task

    You can run any scala code as the task code. Tasks can also take input arguments.

    Pretty much powerful IMO.

    0 讨论(0)
提交回复
热议问题