Run sbt project in debug mode with a custom configuration

前端 未结 3 1532
梦如初夏
梦如初夏 2021-02-09 03:22

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 seem

相关标签:
3条回答
  • 2021-02-09 03:49

    In Intellij IDEA, I just boot the program in Dedug mode and it seems to work properly without further configuration.

    0 讨论(0)
  • 2021-02-09 04:00

    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.

    0 讨论(0)
  • 2021-02-09 04:00

    for simply running sbt project in debug mode , just do

    JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

    and then

    sbt run would run SBT in debug mode, you can create a remote debug configuration in eclipse and connect to it. this is a rather lame, but useful when you have a multi module play project and want to run one of the modules in the debug mode

    0 讨论(0)
提交回复
热议问题