gradle
8.2

# withPluginClasspath

abstract fun withPluginClasspath(): GradleRunner

Sets the plugin classpath based on the Gradle plugin development plugin conventions.

The 'java-gradle-plugin' generates a file describing the plugin under test and makes it available to the test runtime. This method configures the runner to use this file. Please consult the Gradle documentation of this plugin for more information.

This method looks for a file named `plugin-under-test-metadata.properties` on the runtime classpath, and uses the `implementation-classpath` as the classpath, which is expected to a pathSeparatorChar joined string. If the plugin metadata file cannot be resolved an InvalidPluginMetadataException is thrown.

Plugins from classpath are able to be resolved using the `plugins { }` syntax in the build under test. Please consult the TestKit Gradle User Manual chapter for more information and usage examples.

Calling this method will replace any previous classpath specified via withPluginClasspath and vice versa.

Note: this method will cause an InvalidRunnerConfigurationException to be emitted when the build is executed, if the version of Gradle executing the build (i.e. not the version of the runner) is earlier than Gradle 2.8 as those versions do not support this feature. Please consult the TestKit Gradle User Manual chapter alternative strategies that can be used for older Gradle versions.

#### Return

this

#### See also

withPluginClasspath(Iterable)
getPluginClasspath()

abstract fun withPluginClasspath(classpath: Iterable<out File>): GradleRunner

Sets the injected plugin classpath for the build.

Plugins from the given classpath are able to be resolved using the `plugins { }` syntax in the build under test. Please consult the TestKit Gradle User Manual chapter for more information and usage examples.

Note: this method will cause an InvalidRunnerConfigurationException to be emitted when the build is executed, if the version of Gradle executing the build (i.e. not the version of the runner) is earlier than Gradle 2.8 as those versions do not support this feature. Please consult the TestKit Gradle User Manual chapter alternative strategies that can be used for older Gradle versions.

#### Return

this

#### Parameters

classpath

the classpath of plugins to make available to the build under test

#### See also

getPluginClasspath()