get Model
Fetches a snapshot of the model of the given type for the default project. The default project is generally the project referenced when a ProjectConnection is created.
Any of following models types may be available, depending on the version of Gradle being used by the target build:
- GradleBuild
- org.gradle.tooling.model.build.BuildEnvironment
- org.gradle.tooling.model.GradleProject
- org.gradle.tooling.model.gradle.BuildInvocations
- org.gradle.tooling.model.gradle.ProjectPublications
- org.gradle.tooling.model.idea.IdeaProject
- org.gradle.tooling.model.idea.BasicIdeaProject
- org.gradle.tooling.model.eclipse.EclipseProject
- org.gradle.tooling.model.eclipse.HierarchicalEclipseProject
A build may also expose additional custom tooling models. You can use this method to query these models.
Return
The model.
Since
1.8
Parameters
The model type.
The model type.
Throws
When the default project does not support the requested model.
Fetches a snapshot of the model of the given type for the given element, usually a Gradle project.
The following elements are supported as targets:
- Any org.gradle.tooling.model.gradle.BasicGradleProject
- Any org.gradle.tooling.model.GradleProject
- Any org.gradle.tooling.model.eclipse.EclipseProject
- Any org.gradle.tooling.model.idea.IdeaModule
See getModel for more details.
Return
The model.
Parameters
The target element, usually a project.
The model type.
The model type.
Throws
When the target project does not support the requested model.
Fetches a snapshot of the model of the given type using the given parameter.
See getModel for more details.
Return
The model.
Since
4.4
Parameters
The model type.
The model type.
The parameter type.
The parameter type.
Action to configure the parameter
Throws
When the target project does not support the requested model.
When the target project does not support the requested model or Gradle version does not support parameterized models.
Fetches a snapshot of the model of the given type for the given element using the given parameter.
The parameter type must be an interface only with getters and setters and no nesting is supported. The Tooling API will create a proxy instance of this interface and use the initializer to run against that instance to configure it and then pass to the model builder.
See getModel for more details.
Return
The model.
Since
4.4
Parameters
The target element, usually a project.
The model type.
The model type.
The parameter type.
The parameter type.
Action to configure the parameter
Throws
When the target project does not support the requested model.
When the target project does not support the requested model or Gradle version does not support parameterized models.