Runtime dependency at test time

our plugin does the following which works:

project.buildscript.configurations.
classpath.resolvedConfiguration.resolvedArtifacts.
find {'org.jacoco.agent' == it.name}

to pass the location of the jacoco jar into a java call as -Dagent parameter

it is defined in the build script for the plugin jar file:

dependencies {
  runtime group: 'org.jacoco',
  name: 'org.jacoco.agent', version: '0.6.+',
   classifier: 'runtime'
}

but, when doing a unit test of this class, this code does not find any jacoco.jar. why? or how would one do it correctly? i tried to put it into “testCompile” and “compile” group as well. the test is using

import org.gradle.testfixtures.ProjectBuilder
...
    Project project = ProjectBuilder.builder().build()