public class ProjectBuilder extends Object
Creates dummy instances of Project
which you can use in testing custom task and plugin
implementations.
To create a project instance:
ProjectBuilder
instance by calling builder()
.build()
to create the Project
instance.You can reuse a builder to create multiple Project
instances.
The ProjectBuilder
implementation bundled with Gradle 3.0 and 3.1 suffers from a
binary compatibility issue exposed by applying plugins compiled with Gradle 2.7 and earlier.
Applying those pre-compiled plugins in a ProjectBuilder context will result in a ClassNotFoundException
.
Constructor | Description |
---|---|
ProjectBuilder() |
Deprecated.
|
Modifier and Type | Method | Description |
---|---|---|
Project |
build() |
Creates the project.
|
static ProjectBuilder |
builder() |
Creates a project builder.
|
ProjectBuilder |
withGradleUserHomeDir(File dir) |
Specifies the Gradle user home for the builder.
|
ProjectBuilder |
withName(String name) |
Specifies the name for the project
|
ProjectBuilder |
withParent(Project parent) |
Specifies the parent project.
|
ProjectBuilder |
withProjectDir(File dir) |
Specifies the project directory for the project to build.
|
@Deprecated public ProjectBuilder()
builder()
.public static ProjectBuilder builder()
public ProjectBuilder withProjectDir(File dir)
dir
- The project directorypublic ProjectBuilder withGradleUserHomeDir(File dir)
public ProjectBuilder withName(String name)
name
- project namepublic ProjectBuilder withParent(Project parent)
parent
- parent projectpublic Project build()