I have only a partial answer, but I thought this might be useful information. I was just trying to do something similar to build sbt in Spark - I wanted to have a way to run tests using a debugger. Mark Harra's comment pointed me in the right direction. the change I made was :
lazy val TestDebug = config("testDebug") extend(Test)
...
baseProject
.configs(TestDebug)
.settings(inConfig(TestDebug)(Defaults.testTasks): _*)
.settings(Seq(
javaOptions in TestDebug ++= "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
.split(" ").toSeq))
test, testOnly .. , testDebug:testOnly ..., , . (, testDebug:test .. , , .)
, , , , inConfig(TestDebug)(Defaults.testTasks) inConfig(TestDebug)(Defaults.testSettings).
, () () b/c, POM, , .
, sbt , , , , - . , , , .