使用自定义配置在调试模式下运行 sbt 项目 [英] Run sbt project in debug mode with a custom configuration

查看:36
本文介绍了使用自定义配置在调试模式下运行 sbt 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用特殊配置在我的 sbt 0.11 项目中引入调试模式.我尝试使用以下代码来实现这一点,但不幸的是,它似乎没有按预期工作.我正在启动 debug:run 但运行没有按预期挂起.

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 )
}

推荐答案

好的,适用于以下内容:

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 )
}

现在我可以使用 debug:mode 在调试模式下运行我的代码.

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

这篇关于使用自定义配置在调试模式下运行 sbt 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆