Is it possible to create a multi-project setup for plugins in the buildSrc directory? I’d like to create and use a collection of plugins within a wider project but I’d like to develop each plugin individually. e.g.
buildSrc is a separate build. It should be possible to turn it into a multi-project build by putting an appropriate settings.gradle into the buildSrc directory.
Thank you for the prompt response, I re-factored my build environment into the format I laid out above and the collection of plugins are successfully built. However, I’m having trouble actually referencing them for use in the parent multi-project setup.
e.g. I’d like to use plugin1 in the project1 build script. When I was using only one plugin in buildSrc this was as simple as:
apply plugin: "plugin1"
Now with the multi-project setup in ‘buildSrc’ I don’t know how to reference a particular plugin in the ‘project1/build.gradle’ script?
The ‘buildSrc’ mechanism works by putting the runtime classpath of the root project in buildSrc. If you have all your plugins arranged as child projects, add this to the bottom of the build.gradle in ‘buildSrc/’
in the main ‘buildSrc/build.gradle’ script makes all the child projects part of it’s dependencies which in turn are included when it is included during the initialization of the root project’s build classpath.
The problem I had occurred when I added dependencies to one of the child plugins. This is because the ‘buildSrc/build.gradle’ did not have a repository definition that could be used to locate the dependencies of the child plugins.
Adding this line to ‘buildSrc/build.gradle’ solved the problem:
repositories {
mavenCentral()
}
This topic is completely solved for me (although it may be nice to have something in the Gradle documentation to explain how to use buildSrc as a multi-project setup).