DEV Community

Cover image for Debugging gradle plugins
Farix
Farix

Posted on

Debugging gradle plugins

I recently had issues using the axion-release-plugin and wanted to debug the gradle plugin. But all manuals which you can find via google here or here failed because the argument --no-deamon was unknown.

After some digging in the gradle documentation, if found that Dorg.gradle.daemon=false can be used instead.

So to debug your gradle task from a plugin:

  1. Clone the code of the gradle plugin in the specific version of use.
  2. Ensure the plugin code is recognized as source code by your IDE. Maybe you need to start gradle sync or import the project
  3. In your project run ./gradlew myTaskToDebug -Dorg.gradle.debug=true -Dorg.gradle.daemon=false --stacktrace the --stacktrace is optional
  4. Add a remote debug run configuration in your Intellij to the gradle plugin project configuration for the port 5005

4.Set your breakpoint in the plugin code
5.Run your new configuration as debug
6.Happy debugging

Discussion (0)