skip to content

What does the `project-report` plugin add to a Gradle build, and which report tasks does it contribute?

level: juniorimportance: must knowfreq 45%

answer

  1. core plugin, diagnostics only
  2. dependencyReport / htmlDependencyReport
  3. taskReport / propertyReport
  4. projectReport aggregates all four
  5. writes files, not console

basics

~10 s

Applying project-report adds tasks that generate diagnostic reports: dependencyReport, taskReport, propertyReport, and the aggregate projectReport task, plus an HTML dependency report.

solid answer

~30 s

The `project-report` plugin (`apply plugin: 'project-report'` or `id("project-report")`) registers a family of read-only diagnostic tasks that write project information to files under the build directory. The key ones are `dependencyReport` (text dependency tree per configuration), `htmlDependencyReport` (a browsable HTML version, also covering subprojects), `taskReport` (list of tasks), and `propertyReport` (project properties). `projectReport` is a lifecycle/aggregate task that runs them all. These complement the always-available `dependencies`, `tasks`, and `properties` tasks but write to disk instead of the console, which is useful for archiving build documentation or wiring into the build-dashboard.

code

kotlin · 7 lines
kotlin
plugins {
    id("project-report")
}

// then:
// ./gradlew projectReport          -> all reports
// ./gradlew htmlDependencyReport   -> build/reports/project/dependencies/index.html

go deeper

for a junior

Know that applying it adds dependency/task/property report tasks plus the aggregate projectReport, and that they write files.

for a middle

Name htmlDependencyReport's multi-project aggregation and contrast with the console-only dependencies/tasks/properties tasks.

for a senior

Discuss output locations via ReportingExtension and how these feed CI artifact archival and build-dashboard.

for a principal

Frame reporting plugins as part of a build-observability strategy across many repos and how to standardize report locations org-wide.

## What the `project-report` plugin is Gradle ships several *core* plugins — bundled with the distribution, no external coordinates needed. `project-report` is one of them. Unlike language plugins (it compiles nothing), it is a pure *diagnostics* plugin: it registers tasks that introspect the project model and write the result to files. Apply it like any core plugin: ```kotlin plugins { id("project-report") } ``` ## Tasks it contributes - **`dependencyReport`** — writes a textual dependency tree (the same content as the built-in `dependencies` task) to a file, for every resolvable configuration. - **`htmlDependencyReport`** — produces a navigable HTML report of the dependency graph. In a multi-project build it aggregates all subprojects into one report. This is the richest of the set. - **`taskReport`** — writes the project's task list to a file (mirrors the `tasks` task). - **`propertyReport`** — writes the project's properties to a file (mirrors `properties`). - **`projectReport`** — an *aggregate* task with no action of its own; it `dependsOn` the four above so a single invocation produces them all. ## Where output goes Reports land under `build/reports/project/` (and `build/reports/dependencies/` for the HTML dependency report) by default. The directory is governed by the `ReportingExtension` (`reporting { baseDirectory }`), which most reporting plugins honor. ## Why it matters vs. console tasks The built-in `dependencies`/`tasks`/`properties` tasks print to the console — fine interactively, useless for CI archival. `project-report` persists the same information as files you can publish as build artifacts, attach to CI runs, or feed into the `build-dashboard` plugin's aggregated index. ## Relationship to build-dashboard `project-report` produces individual reports; the separate `build-dashboard` plugin gathers all `Reporting`-capable tasks across the build into one `buildDashboard` HTML index that links out to each report.

  • How does `dependencyReport` differ from the built-in `dependencies` task?
    `dependencies` prints the tree to the console; `dependencyReport` (from project-report) writes the same content to a file under the build directory, suitable for archiving.
  • What is the `projectReport` task itself responsible for?
    Nothing directly — it is an aggregate lifecycle task whose only job is to depend on dependencyReport, htmlDependencyReport, taskReport, and propertyReport so they all run together.

saying these in an interview costs you the question

  • Claiming project-report compiles or packages code — it is purely diagnostic.
  • Saying you must add an external dependency for it — it is a bundled core plugin.
  • Confusing it with build-dashboard (which aggregates reports into one index).

context