Dependency substition for "buildscript" dependnecies

Is there a way to make dependency substitution work with buildscript dependencies, so that we could more easily develop Gradle plugins by directly using their sources instead of deploying them first? Simply using something like

buildscript.configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute module('') with project(':plugin')

did not work.

This cannot work, as Gradle needs to evaluate the build scripts before it can start executing the build.

You can install the plugin into mavenLocal and then try it out (which is probably what you are already doing).

Or you could copy the plugin code into the buildSrc folder of your example project and then iterate there. Once you fixed the bug, copy it back to the real plugin repo.

Also, you can use TestKit to test your plugin against realistic builds as part of your functional tests.

1 Like