- java.lang.Object
-
- org.gradle.testfixtures.ProjectBuilder
-
public class ProjectBuilder extends Object
Creates dummy instances of
Projectwhich you can use in testing custom task and plugin implementations.To create a project instance:
- Create a
ProjectBuilderinstance by callingbuilder(). - Optionally, configure the builder.
- Call
build()to create theProjectinstance.
You can reuse a builder to create multiple
Projectinstances. - Create a
-
-
Constructor Summary
Constructors Constructor and Description ProjectBuilder()
-
Method Summary
Methods Modifier and Type Method and Description Projectbuild()Creates the project.
static ProjectBuilderbuilder()Creates a project builder.
ProjectBuilderwithName(String name)Specifies the name for the project
ProjectBuilderwithParent(Project parent)Specifies the parent project.
ProjectBuilderwithProjectDir(File dir)Specifies the project directory for the project to build.
-
-
-
Method Detail
-
builder
public static ProjectBuilder builder()
Creates a project builder.
- Returns:
- The builder
-
withProjectDir
public ProjectBuilder withProjectDir(File dir)
Specifies the project directory for the project to build.
- Parameters:
dir- The project directory- Returns:
- The builder
-
withName
public ProjectBuilder withName(String name)
Specifies the name for the project
- Parameters:
name- project name- Returns:
- The builder
-
withParent
public ProjectBuilder withParent(Project parent)
Specifies the parent project. Use it to create multi-module projects.
- Parameters:
parent- parent project- Returns:
- The builder
-
build
public Project build()
Creates the project.
- Returns:
- The project
-
-