Dependency substition for "buildscript" dependnecies


(Sebastian Schuberth) #1

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('com.my.gradle.plugins:my-plugin') with project(':plugin')
    }
}

did not work.


(Stefan Oehme) #2

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.