Reputation: 103
I'm trying to defined custom task in sbt
that will run main class in debug mode.
lazy val root = (project in file("."))
.settings(
fork in run := true
)
lazy val runDebug = inputKey[Unit]("run in debug")
runDebug := {
javaOptions in run += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" //this doesn't work
(run in Compile).evaluated
},
I cannot make sbt
to set javaOptions
correctly. How to use Def.settings
with inputTask
to define another inputTask
?
Upvotes: 5
Views: 675
Reputation: 48430
Tasks cannot modify settings, instead try commands like so
commands += Command.command("runDebug") { state =>
s"""set javaOptions in run += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005""""::
"run in Compile" :: state
}
Upvotes: 8