I am trying to use a local gradle plugin (lets call it
sample-plugin) in another gradle project (call it
consumer) without having to change the
settings.gradle file of either. I am already able to get it work by using
includeBuild (my-plugin) in the consumer project or by passing the command line flag to include build. But not able use plugin if I create a composite build as either a parent project or sibling project to both consumer and plugin projects.
To demonstrate the problem, I have create the following GitHub repository with all the three variations. I have kept files to bare minimum to just focus on the problem statement.
It contains three directories :
direct-include- consumer directly includes it by changing its own
parent-composite- tries to include the plugin via a parent composite project (without having to change consumer)
sibling-composite- tries to include the plugin via a sibling composite project (without having to change consumer)
When I run them
gradle -p direct-include/consumer sayHello(works)
gradle -p parent-composite :consumer:sayHello(doesn’t work)
gradle -p sibling-composite/composite :consumer:sayHello(doesn’t work)
The case number 2 & 3 fail with following (which essentially means the dependency was not substituted in these build)
Plugin [id: 'org.sample.greeting', version: '1.0-SNAPSHOT'] was not found in any of the following sources:
What am I trying to achieve with this:
Being able to substitute plugin dependency for local debugging without changing both plugin and consumer projects (since i have quite many of them and updating each consumers settings.gradle is undesirable here just to debug)
So, any help in fixing case 2 & 3 is highly appreciated.