Custom run task for subproject with arguments from build.sbt?

I have a subproject named oppenheimer in my project. It's very simple to run this project from the sbt console.

[myproject] $ oppenheimer/run

I can also pass in a command line argument as such:

[myproject] $ oppenheimer/run migrate
[myproject] $ oppenheimer/run clean

How can I do this from build.sbt? Is it possible to define a task that does this? It would suffice to have something like this:

val customMigrate = ...
val customClean = ...

And this is so that I could use it elsewhere in the project, like such:

(test in Test) <<= (test in Test).dependsOn(customMigrate)

Answers


The answer is given in the sbt FAQ section "How can I create a custom run task, in addition to run?". Basically:

lazy val customMigrate = taskKey[Unit]("custom run task")

fullRunTask(customMigrate, Test, "foo.Main", "migrate")

Need Your Help

Foundation 5 - exclude unnecessary components

ruby-on-rails zurb-foundation

Is there a way to exclude foundation components in my rails project from being included in page requests? Every time I hit a page I get a list of requests even though these items are not used.

Stop json data getting sorted in chrome

ajax json google-chrome javascript-objects

I have been facing the problem with feature of Chrome. Just came to know after debugging.