api / org.gradle.testkit.runner / GradleRunner / withPluginClasspath

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 File#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 Guide chapter for more information and usage examples.

Calling this method will replace any previous classpath specified via #withPluginClasspath(Iterable) 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 Guide chapter alternative strategies that can be used for older Gradle versions.

Return
this

See Also
#withPluginClasspath(Iterable)#getPluginClasspath()

Since
2.13

abstract fun withPluginClasspath(classpath: MutableIterable<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 Guide 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 Guide chapter alternative strategies that can be used for older Gradle versions.

Parameters

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

Return
this

See Also
#getPluginClasspath()

Since
2.8