Testing custom gradle plugin with GradleRunner

I'm taking a stab at developing a (Java only) gradle plugin (https://github.com/jdeppe-pivotal/test-in-docker). The gradle structure is very vanilla and my plugin code is in src/main/java.

I'm trying to use the GradleRunner for an integration test and have a test build.gradle resource file:

apply plugin: 'io.pivotal.test.docker-plugin'

task helloWorld {
    doLast {
        println "Hello World!"

The relevant bits of test code are:

BuildResult result = GradleRunner.create()

assertThat(result.getOutput()).contains("Hello World!");

However, the test build fails with:

> Plugin with id 'io.pivotal.test.docker-plugin' not found.

I can see that (what appears to be) a correct classpath is being set with .withPluginClasspath() in the GradleRunner call. What am I doing wrong here?


Changing the test resource build.gradle to reference the plugin as follows:

plugins {
    id 'io.pivotal.test.docker-plugin'