There are a number of Q&A about how to send command line args to sbt run . My question is: how to specify the command line args in a hard-coded manner within build.sbt - where we know how to specify the class itself:
mainClass in Global := Some("mypackage.MyMainClas")
We need to specify the command line parameters in a hardcoded manner in build.sbt due to our toolchain.
You can try create custom run task with the default arguments, like:
lazy val myParameters = Array("arg1", "arg3")
lazy val myRunTask = taskKey[Unit]("A custom run task.")
fullRunTask(myRunTask, Runtime, "mypackage.MyMainClas", myParameters: _*)
and run with: sbt myRunTask.
Reference:
http://www.scala-sbt.org/0.13/docs/Faq.html#How+can+I+create+a+custom+run+task%2C+in+addition+to+%3F
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With