本文介绍了gradle远程调试过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 GRADLE_OPTS 添加到系统环境变量中,如下所示:

I am adding the GRADLE_OPTS to system environment variables as:

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

我已经从InteliJ IDEA为此套接字创建了远程调试器。我可以调试 build.gradle 文件,但无法输入脚本,例如看不到变量值。

I have created the remote debugger from InteliJ IDEA for this socket. I can debug the build.gradle file, but I can't enter into the scripts for example can't see the variable values .

推荐答案

以下是远程调试gradle的步骤:

Here are the steps to remotely debug gradle:

分步指南

1.运行Gradle命令

2.在命令行上,正常执行任务,但添加以下附加参数:

Step-by-step guide
1. Run your Gradle command
2. On the command line, execute your task normally, but add the following additional parameters:

-Dorg.gradle.jvmargs='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5005,suspend=y'

suspend = y 部分将暂停执行,以供您附加调试器。

The "suspend=y" part will pause the execution for you to attach a debugger.

附加调试器:


  1. 在IntelliJ中打开Gradle源代码

  2. 运行->编辑配置

  3. 添加一个通过单击左上角的+来新建配置。

  4. 选择远程,如果愿意,可以将其重命名,然后单击确定

  5. 设置断点
  6. 运行->调试(默认为未命名)

  1. Open the Gradle source code in IntelliJ
  2. Go to Run -> Edit Configurations
  3. Add a new Configuration by clicking the + in the upper left corner
  4. Select Remote, rename it if you choose, and click OK
  5. Set your breakpoints
  6. Go to Run -> Debug "" (defaults to "Unnamed")

这篇关于gradle远程调试过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:43