Model Builder
A ModelBuilder
allows you to fetch a snapshot of some model for a project or a build. Instances of ModelBuilder
are not thread-safe.
You use a ModelBuilder
as follows:
- Create an instance of
ModelBuilder
by calling model. - Configure the builder as appropriate.
- Call either get or get to build the model.
- Optionally, you can reuse the builder to build the model multiple times.
ProjectConnection connection = GradleConnector.newConnector()
.forProjectDirectory(new File("someFolder"))
.connect();
try {
ModelBuilder<GradleProject> builder = connection.model(GradleProject.class);
//configure the standard input in case your build is interactive:
builder.setStandardInput(new ByteArrayInputStream("consume this!".getBytes()));
//if you want to listen to the progress events:
ProgressListener listener = null; // use your implementation
builder.addProgressListener(listener);
//get the model:
GradleProject project = builder.get();
//query the model for information:
System.out.println("Available tasks: " + project.getTasks());
} finally {
connection.close();
}
Content copied to clipboard
Since
1.0-milestone-3
Parameters
<T>
The type of model to build
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard