How to setting up to debug custom gradle plugin


i’m pretty new with gradle and groovy/java but i’m trying developing a custom gradle plugin. I’m struggling setting up for testing my plugin, actually i use 2 different projects (in IntelliJ), one for my plugin and one for testing. When i want to test my plugin i upload artifact to mavelLocal and then switch project to refresh dependencies from my test project and run the task i want to test. I know this is bad since i cant get much info when i get an error.
So what’s the right workflow to debug a plugin maybe having a subproject in my plugin project for testing and/or using unit test?

Thanks for help!

I would encourage you to take a look at the Gradle Test Kit which allows you to create functional tests for your plugins. It’s relatively new and still has a few rough edges, but it’s quite usable and works well.