Custom plugin in a multi java project setup


Using Gradle 4.7.

I have some build code that can benefit from being a plugin. I created a plugin project and try to use it with the other subprojects.

Can anyone share an example project were this setup works?
Seemed that all old examples don’t work.


Place it in buildSrc, then it will be available to the rest of the build. along with covers the basic of getting started.

In the you can find samples/multiProjectBuildSrc which has a simple working example too.

thanks @staffanf

I cannot make this to work:
When I apply the plugin it tell me it is not found.
'plugin with id xxx not found

I tried with full name or just plugin name.
I have a properties file with the plugin class

  1. my plugin is java (not groovey)
  2. my projects organised in multi level nested folder structure

any java plugin example?

Create a minimal viable example of what does not work and post it here or on github.
Then we can help you get it started.

Thanks @staffanf

Here is my example code ->

Thanks in advance.

Here’s a patch for a fixed version:

The main problem was that I don’t think you can have subprojects in buildSrc

thanks @staffanf, can you submit a pull request?

Can you seperate plugins with different properties files in the same buildSrc directory?


Yes, just use more blocks in the dsl like:

 gradlePlugin {
    plugins {
        integrationPlugin {
            id = 'com.rds.example.gradle.integration-plugin'
            implementationClass = 'com.rds.example.gradle.IntegrationPlugin'
        pluginB {
            id = ''
            implementationClass = 'some.other.PluginClass'
1 Like

There’s also nothing wrong with buildSrc being a multi-project build. However, the root project must have a runtime dependency on the subprojects you want to include (see Organizing Build Logic - Build Sources).

There’s no problem including all subprojects in one go, if that’s what you want:


dependencies {
    runtime subprojects

1 Like

awesome! thanks @jjustinic

thanks @staffanf, cool, this is what I thought.