Igor's Techno Club

Debugging Gradle

There are couple of way you may use to debug Gradle with IntelliJ Idea

Debugging Gradle with IntelliJ IDEA

There are a couple of ways you can use to debug Gradle with IntelliJ IDEA.

Create a Remote Debugger

Before we start, you will need to create a Debugger configuration. It should be a Remote configuration, and you can leave all the configuration settings as they are.

Debugging Gradle Scripts

To debug a Gradle script, execute the following command:

./gradlew anyTask -Dorg.gradle.debug=true --no-daemon

After running this command, Gradle will initiate the script but won't proceed until you start the debugger. You can then set up debugging points in the Gradle file itself.

Debugging Gradle Tasks

I mainly use this for debugging JUnit tests:

./gradlew test --debug-jvm

This command starts a Gradle task, but it halts at the test execution step and waits until the Debugger is started. After that, you can begin debugging your unit tests.

Happy coding!

#debugging #gradle #java