# Debug gradle plugins

To debug a gradle plugin in the real project:

* Open plugin project and add “remote” configuration (with defaults - it would be port 5005)
    
* Run gradle: `./gradlew task -Dorg.gradle.debug=true` (it will halt waiting for remote debugger attachment)
    
* Run remote debug in plugin project
    

All details are in the [gradle docs](https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic)

**Note**: in case of “port already in use” error, try to stop deamons first (`./gradlew —stop`) and, if it will not help, search for other java processes occuping the port (`lsof -i :5005`).
