How to attach a JavacPlugin for the tests?

I’m trying to write a JavacPlugin. I want to be able to test it through my gradle system, however I’m uncertain as to how I can tell gradle to add my own code as a dependency, in order for it to target the javac plugin. Is it even possible, if not, what else can I do to manage both the plugin and it’s tests in a sane manner?