Dependency on In-Project Gradle Plugin

I’m writing a Gradle plugin which I have in ‘plugin/’ and I’d also like to include a sample in ‘sample/’ to demonstrate real-world use. As such, I was hoping to apply the plugin created from the output of ‘plugin/’'s build to the sample. This doesn’t seem to be possible because of how the build script is evaluated up front.

Is something like this possible? I’ve searched a bit but haven’t been able to surface any documentation on this type of plugin testing.

It’s not currently possible. It’s something we are working towards, but it will be a while before Gradle has the capability (it’s very tricky to implement).

In the meantime, you can create a task in the plugin project to do a local install (either to mavenLocal()) or a project relative file system repo. Then in the sample project’s buildscript block you can source the plugin from this repo. This approach requires that the sample project NOT be part of the multi project build.

Or alternatively, you can pull some tricks to map the buildSrc project to your plugin project. This only works in simple cases. You can see an example of this kind of approach with this project: https://github.com/ratpack/ratpack