How to debug custom plugin?

Hi All expert,

I have own developed plugins. At the moment, i build it and upload them to maven. Then run build for the project which use this plugin to see the result. This is not efficient way to test.
Is there any way to debug the custom plugin directly from main project?
I saw some blogs which set org.gradle.debug=true. But it seems it does not help in my case.
Thanks for your help in advance.

I guess what you are looking for is composite builds.
Using composite builds, you can include your plugin build and directly use it in your project without publishing the plugin to a Maven repository. The blog post contains an example how to do so.

Hi Stefan,

I am not taking about composite build. I am talking about how to debug own developed plugin.
I have an own developed plugin which do special steps with groovy code.Then I used apply plugin ‘plugin name’ in build.gradle.

Now I want to debug the plugin to see my own code works properly or not.

If you want to debug a build, run the build with -Dorg.gradle.debug=true, as you said above. Then you need to set the appropriate breakpoints and should be good to go. Using a composite with this flag has the advantage that you can directly navigate to the sources of your plugin.
You may be interested in this Webinar:

Hi @sanchezwangNanjing,

Look how others developers test/implement the gradle plugins, an example of how to test a plugin without deploy: