The Gradle model
task shows the objects in the model space of Gradle. The output shows the object hierarchy. By default a full report is shown, with a lot of information. We can customize the output format with the --format
task argument. The default value is full
, but we can also use the value short
. With the value short
a lot less information is shown.
Let's see the output of the model
task for a sample project:
$ gradle -q model ------------------------------------------------------------ Root project ------------------------------------------------------------ + tasks | Type: org.gradle.model.ModelMap<org.gradle.api.Task> | Creator: Project.<init>.tasks() | Rules: ⤷ VersionFileTaskRules#createVersionFileTask(ModelMap<Task>, VersionFile) + buildEnvironment | Type: org.gradle.api.tasks.diagnostics.BuildEnvironmentReportTask | Value: task ':buildEnvironment' | Creator: tasks.addPlaceholderAction(buildEnvironment) | Rules: ⤷ copyToTaskContainer + components | Type: org.gradle.api.reporting.components.ComponentReport | Value: task ':components' | Creator: tasks.addPlaceholderAction(components) | Rules: ⤷ copyToTaskContainer + dependencies | Type: org.gradle.api.tasks.diagnostics.DependencyReportTask | Value: task ':dependencies' | Creator: tasks.addPlaceholderAction(dependencies) | Rules: ⤷ copyToTaskContainer + dependencyInsight | Type: org.gradle.api.tasks.diagnostics.DependencyInsightReportTask | Value: task ':dependencyInsight' | Creator: tasks.addPlaceholderAction(dependencyInsight) | Rules: ⤷ HelpTasksPlugin.Rules#addDefaultDependenciesReportConfiguration(DependencyInsightReportTask, ServiceRegistry) ⤷ copyToTaskContainer + dependentComponents | Type: org.gradle.api.reporting.dependents.DependentComponentsReport | Value: task ':dependentComponents' | Creator: tasks.addPlaceholderAction(dependentComponents) | Rules: ⤷ copyToTaskContainer + generateVersionFile | Type: mrhaki.gradle.VersionFileTask | Value: task ':generateVersionFile' | Creator: VersionFileTaskRules#createVersionFileTask(ModelMap<Task>, VersionFile) > create(generateVersionFile) | Rules: ⤷ copyToTaskContainer + help | Type: org.gradle.configuration.Help | Value: task ':help' | Creator: tasks.addPlaceholderAction(help) | Rules: ⤷ copyToTaskContainer + init | Type: org.gradle.buildinit.tasks.InitBuild | Value: task ':init' | Creator: tasks.addPlaceholderAction(init) | Rules: ⤷ copyToTaskContainer + model | Type: org.gradle.api.reporting.model.ModelReport | Value: task ':model' | Creator: tasks.addPlaceholderAction(model) | Rules: ⤷ copyToTaskContainer + projects | Type: org.gradle.api.tasks.diagnostics.ProjectReportTask | Value: task ':projects' | Creator: tasks.addPlaceholderAction(projects) | Rules: ⤷ copyToTaskContainer + properties | Type: org.gradle.api.tasks.diagnostics.PropertyReportTask | Value: task ':properties' | Creator: tasks.addPlaceholderAction(properties) | Rules: ⤷ copyToTaskContainer + tasks | Type: org.gradle.api.tasks.diagnostics.TaskReportTask | Value: task ':tasks' | Creator: tasks.addPlaceholderAction(tasks) | Rules: ⤷ copyToTaskContainer + wrapper | Type: org.gradle.api.tasks.wrapper.Wrapper | Value: task ':wrapper' | Creator: tasks.addPlaceholderAction(wrapper) | Rules: ⤷ copyToTaskContainer + versionFile | Type: mrhaki.gradle.VersionFile | Creator: VersionFileTaskRules#versionFile(VersionFile) | Rules: ⤷ versionFile { ... } @ build.gradle line 8, column 5 + outputFile | Type: java.io.File | Value: /Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/gradle/versionrule/build/version.file | Creator: VersionFileTaskRules#versionFile(VersionFile) + version | Type: java.lang.String | Value: 1.0.1.RELEASE | Creator: VersionFileTaskRules#versionFile(VersionFile) $
Now we use the short format:
$ gradle -q model --format=short ------------------------------------------------------------ Root project ------------------------------------------------------------ + tasks | buildEnvironment = task ':buildEnvironment' | components = task ':components' | dependencies = task ':dependencies' | dependencyInsight = task ':dependencyInsight' | dependentComponents = task ':dependentComponents' | generateVersionFile = task ':generateVersionFile' | help = task ':help' | init = task ':init' | model = task ':model' | projects = task ':projects' | properties = task ':properties' | tasks = task ':tasks' | wrapper = task ':wrapper' + versionFile | outputFile = /Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/gradle/versionrule/build/version.file | version = 1.0.1.RELEASE $
Written with Gradle 3.2.