Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run sbt project in debug mode with a custom configuration

Tags:

scala

sbt

I want to introduce a debug mode in my sbt 0.11 project using a special configuration. I've tried to implement this using the following code but unfortunately, it doesn't seems to work as expected. I'm launching debug:run but the run doesn't suspends as expected.

object Test extends Build {
  lazy val root = Project("test", file("."))
    .configs( RunDebug )
    .settings( inConfig(RunDebug)(Defaults.configTasks):_*)
    .settings(
      name := "test debug",
      scalaVersion := "2.9.1",
      javaOptions in RunDebug += "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005",
      fork in RunDebug := true
    )

  lazy val RunDebug = config("debug").extend( Runtime )
}
like image 576
David Avatar asked Nov 12 '11 12:11

David


People also ask

What does sbt clean do?

clean – delete all generated sources, compiled artifacts, intermediate products, and generally all build-produced files. reload – reload the build, to take into account changes to the sbt plugin and its transitive dependencies.


1 Answers

Ok that works with the following :

object Test extends Build {
  lazy val root = Project("test", file("."))
    .configs( RunDebug )
    .settings( inConfig(RunDebug)(Defaults.configTasks):_*)
    .settings(
      name := "test debug",
      scalaVersion := "2.9.1",
      javaOptions in RunDebug ++= Seq("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
      fork in RunDebug := true
    )

  lazy val RunDebug = config("debug").extend( Runtime )
}

now I can run my code in debug mode using debug:mode.

like image 113
David Avatar answered Sep 18 '22 12:09

David