【问题标题】:sbt on linux not accepting -jvm-debug 5005linux上的sbt不接受-jvm-debug 5005
【发布时间】:2017-06-27 16:11:59
【问题描述】:

我在 Arch Linux 上使用来自官方 Arch 存储库的 sbt 启动器 0.13.7 版。我正在尝试使用 IntelliJ 调试 scala 应用程序。

我查看的所有其他地方,包括其他堆栈溢出问题,似乎都说 Linux 版本的 sbt 可以通过简单地调用“sbt -jvm-debug 5005”来调试

但是,当我这样做时,我会收到一长串错误:

[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[error] Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected ';'
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] Expected '-'
[error] 5005
[error] ^
[error] Not a valid command: jvm-debug
[error] Not a valid project ID: jvm-debug
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: jvm-debug
[error] jvm-debug
[error]          ^

为什么会这样,如何设置 sbt 项目以在端口上调试?

【问题讨论】:

    标签: linux debugging intellij-idea sbt archlinux


    【解决方案1】:

    看来这行得通:

    export SBT_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" && sbt
    

    但是,如果有人知道,我仍然想知道为什么“sbt -jvm-debug 5005”在 Arch 上不起作用。

    【讨论】:

    • 我在 Windows 10 下,我有完全相同的错误。我一直在使用激活器并转移到 sbt,因为它在年底 EOL-ed。很奇怪……
    • 运行 sbt -jvm-debug 5005 时也会在 macOS X 上发生
    【解决方案2】:

    问题是关于 Linux 上的 SBT,但我在 OS X 中遇到了同样的问题。

    OS X 中的 SBT 0.13.9 既不接受 -jvm-debug 也不遵循接受答案中提供的 SBT_OPTS 环境。

    但是,这是可行的:

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

    【讨论】:

      猜你喜欢
      • 2021-09-14
      • 2018-02-08
      • 2015-03-31
      • 1970-01-01
      • 2012-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-11
      相关资源
      最近更新 更多