api / org.gradle.api.reporting / Reporting

Reporting

interface Reporting<T : ReportContainer<Report>>

An object that provides reporting options.

Tasks that produce reports as part of their execution expose configuration options of those reports via these methods. The Reporting interface is parameterized, where the parameter denotes the specific type of reporting container that is exposed. The specific type of the reporting container denotes the different types of reports available.

For example, given a task such as:

 class MyTask implements Reporting<MyReportContainer> { // implementation } interface MyReportContainer extends ReportContainer<Report> { Report getHtml(); Report getCsv(); } 

The reporting aspects of such a task can be configured as such:

 task my(type: MyTask) { reports { html.enabled = true csv.enabled = false } } 

See the documentation for the specific ReportContainer type for the task for information on report types and options.

Parameters

- The base type of the report container

Functions

getReports

abstract fun getReports(): T

A ReportContainer instance.

Implementors specify a specific implementation of ReportContainer that describes the types of reports that are available.

reports

abstract fun reports(closure: Closure<Any>): T
abstract fun reports(configureAction: Action<in T>): T

Allow configuration of the report container by closure.

 reports { html { enabled false } xml.destination "build/reports/myReport.xml" } 

Inheritors

AbstractTestTask

abstract class AbstractTestTask : ConventionTask, VerificationTask, Reporting<TestTaskReports>

Abstract class for all test task.

  • Support for test listeners
  • Support for reporting
  • Support for report linking in the console output

Note: This abstract class is not intended for implementation by build script or plugin authors.

Checkstyle

open class Checkstyle : SourceTask, VerificationTask, Reporting<CheckstyleReports>

Runs Checkstyle against some source files.

CodeNarc

open class CodeNarc : SourceTask, VerificationTask, Reporting<CodeNarcReports>

Runs CodeNarc against some source files.

FindBugs

open class FindBugs : SourceTask, VerificationTask, Reporting<FindBugsReports>

Analyzes code with FindBugs. See the FindBugs Manual for additional information on configuration options.

GenerateBuildDashboard

open class GenerateBuildDashboard : DefaultTask, Reporting<BuildDashboardReports>

Generates build dashboard report.

HtmlDependencyReportTask

open class HtmlDependencyReportTask : ConventionTask, Reporting<DependencyReportContainer>

Generates an HTML dependency report. This report combines the features of the ASCII dependency report and those of the ASCII dependency insight report. For a given project, it generates a tree of the dependencies of every configuration, and each dependency can be clicked to show the insight of this dependency.

This task generates a report for the task's containing project by default. But it can also generate a report for multiple projects, by setting the value of the projects property. Here's how to generate an HTML dependency report for all the projects of a multi-project build, for example:

 htmlDependencyReport { projects = project.allprojects } 

The report is generated in the build/reports/project/dependencies directory by default. This can also be changed by setting the reports.html.destination property:

 htmlDependencyReport { reports.html.destination = file("build/reports/project/dependencies") } 

JDepend

open class JDepend : DefaultTask, Reporting<JDependReports>

Analyzes code with JDepend.

JacocoReport

open class JacocoReport : JacocoReportBase, Reporting<JacocoReportsContainer>

Task to generate HTML, Xml and CSV reports of Jacoco coverage data.

Pmd

open class Pmd : SourceTask, VerificationTask, Reporting<PmdReports>

Runs a set of static code analysis rules on Java source code files and generates a report of problems found.