How to setup a project to build gradle plugin and then use in the same build?

I remember this is pretty much a desire by any plugin developer so they can have a sibling project that uses/tests the plugin which is my case as well and am hoping 1 of the versions of gradle has a semi-clean possibly hacky way of doing this.

We like the eat our own medicine mantra so for a while now we have been releasing the plugin and then using the PREVIOUS version of the plugin to build the rest of our project. Recently bintray started deprecating their stuff and now our master is broken with this philosophy. I remember a feature came out in Gradle where we could build the plugin in one project and use in another in a single multi-project build. I can’t seem to find the documentation or how to do that.

Any pointers on building and using in the same multi-project build would be fabulous and our build would no longer depend on the remote connection to some artifact repository.

I found this old post which is way too old → Can I develop a Gradle plugin as sibling project in multi project build setup? - #4 by chris_molozian


The feature you are looking for is Composite Builds.

QUESTION 1: ohhh, so this page does not work for a multi-project build, correct? → Developing Custom Gradle Plugins

QUESTION 2: How do I make it so in that composite build, we publish ONLY the plugin and nothing else to a local /tmp/myRepo AND THEN at the end publish everything to a remote repo? (ie. a full build run that will run all tests, etc. which requires publishing locally first, then publish all artifacts at the end)

If you use an “included build” then the plugin dependency on your sample project is automatically substituted with the artifact from your plugin project.

yeah, I finally figured out this does not work in 6.8.3 in a certain case and then in 7.1.1 it worked so something must have been fixed. I flipped back and forth to verify so I was forced to upgrade for this.

specifically, gradle 6.8.3 did not allow me to have two projects using the plugin where project 2 depended on project 1 and both used the plugin. I used their sample and modified it and upgraded and downgraded to verify. This took me a while to find it was just a bug in 6.8.3.

Interesting. Thanks for sharing. I have a sample Android app project and a sample Android library project set up. They are independent from each other. I still use Gradle 6.9. Let’s see what happens with Gradle 7.