How to debug a Gradle build.gradle file (in a debugger, with breakpoints)?

后端 未结 5 859
攒了一身酷
攒了一身酷 2020-12-12 13:01

Is there a tool that will allow me to set breakpoints in a build.gradle file and step through tasks in a debugger?

Note: I believe that I\'m asking a different ques

5条回答
  •  温柔的废话
    2020-12-12 13:37

    There is the easier way:

    just add in your command line -Dorg.gradle.debug=true --no-daemon

    For example: gradle nameOfTask -Dorg.gradle.debug=true --no-daemon

    Then you should start your IDE and run remote debugging with localhost port 5005, that all.

    Gradle is waiting to you, because standard option server=y

    org.gradle.debug

    When set to true, Gradle will run the build with remote debugging enabled, listening on port 5005. Note that this is the equivalent of adding -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 to the JVM command line and will suspend the virtual machine until a debugger is attached.

    Link to docs

提交回复
热议问题