Composite build with plugin dependencies


(DC) #1

I have been reading about the new Composite build feature in version 3 of gradle. If i have a custom build plugin, will composite build support the substitution of the plugin
So Proj1 has:

apply plugin: 'myplugin'
...
buildscript {
    dependencies {
                classpath group: 'demo', name: 'myplugin', version: '1.0.0'
    }
}'

Can we then do gradle --include-build ../myplugin and have the dependency substituted above?
Would be useful when making changes to a plugin and testing the changes against another project that uses the plugin.

Thanks.


(Stefan Oehme) #2

Yes, you can. Have a look at this sample for more info.


(DC) #3

Thanks Stefan, exactly what i needed.


(Don Henry) #4

I’m trying to do this same thing but my buildscript is as below and the includeBuild doesn’t work. Is it because I’m explicitly including the plugin JARs? Thanks. BTW, this is with version 3.5.

  buildscript {
    dependencies {
      classpath fileTree(include: ['*.jar'], dir: "$gradle.gradleHomeDir/lib/metaplugins")
    }
  }

(Don Henry) #5

That was the issue. Once I replaced the fileTree entry with classpath entries, the composite build picked up the folder specified with includeBuild.

BTW, the particular plugin source tree did not have a settings.gradle or build.gradle because these were handled in a parent folder (all the plugins projects are handled as subprojects). To make things work (i.e. get the composite build to actually use the plugin source), I had to add an empty settings.gradle and a functioning build.gradle (by moving the configuration from the parent project) to the plugin source tree.