命令行上给出-jvm-debug时如何在Test中设置fork? [英] How to set fork in Test when -jvm-debug given on command line?

查看:42
本文介绍了命令行上给出-jvm-debug时如何在Test中设置fork?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果项目在调试模式下运行,是否有条件禁用分叉:

Is there a way to conditionally disable forking if the project is run in debug mode:

sbt -jvm-debug 9999

然后在我的构建中:

fork in Test := { 
  //find a key that lets me know if debugging in set up
  !isDebugging.value
}

推荐答案

指定flywayUrl 通过 SBT 中的系统属性 应该会有所帮助.

将以下内容添加到 build.sbt:

lazy val isDebugging = settingKey[Boolean]("true when xdebug is true; false otherwise")

isDebugging := System.getProperty("xdebug") == "true"

fork in Test := !isDebugging.value

当你执行 sbt -Dxdebug=true 时,它会给你你想要的.

When you execute sbt -Dxdebug=true it gives you what you want.

顺便说一句,我在 SBT 源代码中没有看到对 jvm-debug 的引用,但它确实在我用来启动它的 shell 脚本中.可能是您必须更改 sbt-launch-lib.bash 以适应在设置 -Xdebug 时添加 xdebug 的更改.

BTW I see no references to jvm-debug in the SBT sources, but it is indeed in the shell script I'm using to fire it up. It could be that you'd have to change sbt-launch-lib.bash to accommodate the change to add xdebug when -Xdebug is set.

这篇关于命令行上给出-jvm-debug时如何在Test中设置fork?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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