gradle
8.5

# withProjectDir

abstract fun withProjectDir(projectDir: File): GradleRunner(source)

Sets the directory that the Gradle will be executed in.

This is typically set to the root project of the build under test.

A project directory must be set. This method must be called before build or buildAndFail.

All builds executed with the runner effectively do not search parent directories for a `settings.gradle` file. This suppresses Gradle's default behaviour of searching upwards through the file system in order to find the root of the current project tree. This default behaviour is often utilised when focusing on a particular build within a multi-project build. This behaviour is suppressed due to test builds being executed potentially being created within a “real build” (e.g. under the `/build` directory of the plugin's project directory).

#### Return

`this`

#### Parameters

projectDir

the project directory

#### See also

getProjectDir()