VS代码 /金属:如何使用远程调试器调试Scala SBT项目?

发布于 2025-01-28 05:44:55 字数 708 浏览 3 评论 0原文

我知道之前已经提出过一个问题在这里,但我根本无法弄清楚如何在VS代码(WSL)中调试我的Scala SBT项目。有人可以提供有关如何做到这一点的详细说明吗?使用(Java)远程调试器调试意味着什么?

当我经营金属医生时,它说它甚至无法检测到构建工具。但是,从终端中,我可以很好地运行/编译代码(fe说SBT“ testOnly *intestionTaskTasktest”)。

我添加了以下启动。输入debug之后:选择并开始在命令pallette中进行调试:

"version": "0.2.0",
"configurations": [
    {
        "type": "scala",
        "request": "launch",
        "name": "somename",
        "mainClass": "somepackage.SparkMain",
        "args": [],
        "jvmOptions": []
      }  

但是我收到class:sompackage.sparkmain找不到>

I know the question has been asked before in some variation here, but I simply can not figure out how to debug my scala sbt project in VS Code (WSL). Can someone provide some detailed instruction on how to do that ? What does it mean to debug using (java) remote Debugger ?

When I run Metals doctor, it says that it can not even detect the build tool. From the terminal however I am able to run/compile the code just fine (F.e. saying sbt "testOnly *IngestionTaskTest").

I addded the following launch.json file after entering >Debug: Select and Start Debugging in command Pallette:

"version": "0.2.0",
"configurations": [
    {
        "type": "scala",
        "request": "launch",
        "name": "somename",
        "mainClass": "somepackage.SparkMain",
        "args": [],
        "jvmOptions": []
      }  

But I receive Class: sompackage.SparkMain not found

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰つ倒转 2025-02-04 05:44:55

好的,我发现了如何做。这些是确切的步骤:

1。)配置启动。首先转到命令pallette并说> debug:选择并开始在命令pallette 2中进行调试

2)然后编辑启动。json看起来像这样:

    "version": "0.2.0",
"configurations": [
    {
        "type": "java",
        "request": "attach",
        "name": "gqd debugger",
        "hostName": "localhost",
        "port": "8000",
    }
]
}

4。)启用build.sbt中的sbt debugger,通过添加以下行:> test/javaoptions +=“ -agentlib:jdwp = transport = dt_socket,server = y,suppend = n,dorkes = 8000”

5.)在bash终端中说sbt spest test/testonly tesonly thetest

6)秒直到项目&设置已加载。然后按Putton F5

(测试是指我的单位测试)。希望它有帮助。

Ok I found out how to do it. These are the exact steps:

1.) Configure launch.json manually. First go to command pallette and say >Debug: Select and Start Debugging in command Pallette

2.) Then edit launch.json to look like this:

    "version": "0.2.0",
"configurations": [
    {
        "type": "java",
        "request": "attach",
        "name": "gqd debugger",
        "hostName": "localhost",
        "port": "8000",
    }
]
}

4.) Enable sbt debugger in build.sbt by adding the following line: Test / javaOptions += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"

5.) In the bash terminal say sbt Test/testOnly theTest

6.) Wait a few seconds until project & settings are loaded. Then press putton F5

(Tests refers to my unit tests). Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文