SBT. runMain with arguments inside task

Viewed 650

I have a simple task:

lazy val myCustomTask = TaskKey[Unit]("description of my task")
myCustomTask := {
    val arg = "arg1"   // Not used yet
    (runMain in Compile).toTask(" com.company.Main").value
}

It works fine.

But i need to pass some arguments. If i do this:

(runMain in Compile).toTask(s" com.company.Main $arg").value

I get error:

error: Illegal dynamic reference: arg
(runMain in Compile).toTask(s" com.company.Main $arg").value
^
[error] Type error in expression

How to pass argument correctly?

P.S. Sorry for my english, it's not my native.

1 Answers
Related