Skip to content

Project

class Project

Represents a Gradle project.

To access an instance of this type, use Gradle.rootProject or Gradle.project.

Properties

buildDir

The build directory for this Project.

buildGroovy

suspend fun Project.buildGroovy(text: String)

Helper function to write the build.gradle file.

Example
test("Create a groovy build file") {
    gradle.project("foo").buildGroovy("""
        println "Loading the project :foo…"
    """.trimIndent())
}

See also

Accessor for the build.gradle file.

Example
test("Access the groovy build file") {
    println(gradle.project("foo").buildGroovy())
}

See also

buildKts

suspend fun Project.buildKts(text: String)

Helper function to write the build.gradle.kts file.

Example
test("Create a Kotlin build file") {
    gradle.project("foo").buildKts("""
        println("Loading the project :foo…")
    """.trimIndent())
}

See also

Accessor for the build.gradle.kts file.

Example
test("Access the Kotlin build file") {
    println(gradle.project("foo").buildKts())
}

See also

dir

val dir: Prepared<Path>

The subdirectory of Gradle.dir in which this project is located.

Example
test("Print the project structure") {
    println(gradle.dir())
    println(gradle.project("foo").dir())
}

Functions