If you find yourself needing to debug Gradle source code, here’s a few simple steps you need to follow. There are some great posts online that explain how to attach a remote debugger, like this one.
In this post I show an alternative solution which runs Gradle inside the IDE.
- Clone Gradle repository:
- Checkout a specific release:
- Generate IntelliJ files:
- Import Gradle project into IntelliJ:
- Edit Gradle Run Configuration to point to the project you want to run gradle on:
The -b option allows you to pass a path to the build.gradle
Set your breakpoints
Hit Debug and wait for your breakpoint: