Single repository, multi-project with multi-plugins testkit cannot find dependent plugin


(Jason Morefield) #1


I’m in the process of building a modular Gradle plugin which necessitates some of the sub-projects which are gradle plugins to depend on other sub-projects which are gradle plugins. The plugins correctly apply the plugin that they depend on, but when I attempt to use testkit’s GradleRunner even calling withPluginClasspath() on the runner the plugin that is being depended on is not found during testing. I’m using testkit in the “root” plugin just fine and it passes all my tests correctly applying the plugin and executing the tasks, but I cannot apply the root plugin and execute the very same task from within the sub-project plugin that depends on the root. I have correctly declared the compile time dependency between the sub-projects and can see the classes fine and the code compiles with references across the dependency declaration.

I have validated the injected classpath properties file correctly includes the built JAR for the plugin being depended on and have confirmed the JAR correctly declares META-INF/gradle-plugins/ with the correct class. Does Gradle + testkit not support this ability to have plugins as sub-projects of a multi-project build depend on one another and be testable? Thank you very much!