# Class Groovydoc

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
org.gradle.api.tasks.javadoc.Groovydoc

All Implemented Interfaces:
  `Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, PatternFilterable, Configurable<Task>`

@CacheableTask public abstract class Groovydoc extends SourceTask

Generates HTML API documentation for Groovy source, and optionally, Java source.

This task uses Groovy's Groovydoc tool to generate the API documentation. Please note that the Groovydoc tool has some limitations at the moment. The version of the Groovydoc that is used, is the one from the Groovy dependency defined in the build script.

Since:
  0.7

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Groovydoc.Link`
  A Link class represent a link between groovydoc/javadoc output and url.

  ### Nested classes/interfaces inherited from interface Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface Task

  `TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Groovydoc()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `generate()`
  Generate.
  `abstract Property<GroovydocAccess>`
  `getAccess()`
  The most restrictive access level to include in the Groovydoc.
  `abstract ConfigurableFileCollection`
  `getAdditionalStylesheets()`
  Additional stylesheets to copy into the generated documentation alongside the default stylesheet, preserving each file's name.
  `FileCollection`
  `getClasspath()`
  Returns the classpath used to locate classes referenced by the documented sources.
  `protected abstract org.gradle.internal.file.Deleter`
  `getDeleter()`
  `File`
  `getDestinationDir()`
  Returns the directory to generate the documentation into.
  `abstract DirectoryProperty`
  `getDestinationDirectory()`
  Returns the directory to generate the documentation into.
  `@Nullable String`
  `getDocTitle()`
  Returns the title for the package index(first) page.
  `@Nullable String`
  `getFooter()`
  Returns the HTML footer for each page.
  `FileCollection`
  `getGroovyClasspath()`
  Returns the classpath containing the Groovy library to be used.
  `@Nullable String`
  `getHeader()`
  Returns the HTML header for each page.
  `abstract Property<Boolean>`
  `getIncludeAuthor()`
  Whether to include author paragraphs.
  `abstract Property<Boolean>`
  `getIncludeMainForScripts()`
  Whether to include main method for scripts.
  `abstract Property<JavaLauncher>`
  `getJavaLauncher()`
  The Java launcher used to start the worker process for generating Groovydoc.
  `protected abstract JavaToolchainService`
  `getJavaToolchainService()`
  `abstract Property<JavaLanguageVersion>`
  `getJavaVersion()`
  The Java language version used when parsing Java source files, e.g.
  `Set<Groovydoc.Link>`
  `getLinks()`
  Returns the links to groovydoc/javadoc output at the given URL.
  `abstract Property<String>`
  `getMaxMemory()`
  Returns the amount of memory allocated to this task.
  `abstract Property<Boolean>`
  `getNoDeprecatedList()`
  Whether to suppress generation of the deprecated-list page (`deprecated-list.html`) and its nav-bar link.
  `abstract Property<Boolean>`
  `getNoHelp()`
  Whether to suppress generation of the help page (`help-doc.html`) and its nav-bar link.
  `abstract Property<Boolean>`
  `getNoIndex()`
  Whether to suppress generation of the alphabetical index page (`index-all.html`) and its nav-bar link.
  `protected abstract ObjectFactory`
  `getObjectFactory()`
  `@Nullable TextResource`
  `getOverviewText()`
  Returns a HTML text to be used for overview documentation.
  `abstract Property<String>`
  `getPreLanguage()`
  The default language id applied to preformatted code blocks in rendered doc comments that carry no `class` attribute.
  `abstract Property<Boolean>`
  `getProcessScripts()`
  Whether to process scripts.
  `abstract Property<Boolean>`
  `getShowInternal()`
  Whether to include members annotated with `groovy.transform.Internal` (per GEP-17) in the generated documentation.
  `FileTree`
  `getSource()`
  Returns the source for this task, after the include and exclude patterns have been applied.
  `abstract Property<String>`
  `getSyntaxHighlighter()`
  The client-side syntax highlighter for `{@snippet}` and fenced Markdown code blocks.
  `abstract Property<String>`
  `getTheme()`
  The theme lock mode for the generated documentation.
  `@Nullable String`
  `getWindowTitle()`
  Returns the browser window title for the documentation.
  `protected abstract WorkerExecutor`
  `getWorkerExecutor()`
  `boolean`
  `isNoTimestamp()`
  Returns whether to include timestamp within hidden comment in generated HTML (Groovy >= 2.4.6).
  `boolean`
  `isNoVersionStamp()`
  Returns whether to include version stamp within hidden comment in generated HTML (Groovy >= 2.4.6).
  `boolean`
  `isUse()`
  Returns whether to create class and package usage pages.
  `void`
  `link(String url, String... packages)`
  Add links to groovydoc/javadoc output at the given URL.
  `void`
  `setClasspath(FileCollection classpath)`
  Sets the classpath used to locate classes referenced by the documented sources.
  `void`
  `setDestinationDir(File destinationDir)`
  Sets the directory to generate the documentation into.
  `void`
  `setDocTitle(@Nullable String docTitle)`
  Sets title for the package index(first) page (optional).
  `void`
  `setFooter(@Nullable String footer)`
  Sets footer text for each page (optional).
  `void`
  `setGroovyClasspath(FileCollection groovyClasspath)`
  Sets the classpath containing the Groovy library to be used.
  `void`
  `setHeader(@Nullable String header)`
  Sets header text for each page (optional).
  `void`
  `setLinks(Set<Groovydoc.Link> links)`
  Sets links to groovydoc/javadoc output at the given URL.
  `void`
  `setNoTimestamp(boolean noTimestamp)`
  Sets whether to include timestamp within hidden comment in generated HTML (Groovy >= 2.4.6).
  `void`
  `setNoVersionStamp(boolean noVersionStamp)`
  Sets whether to include version stamp within hidden comment in generated HTML (Groovy >= 2.4.6).
  `void`
  `setOverviewText(@Nullable TextResource overviewText)`
  Sets a HTML text to be used for overview documentation (optional).
  `void`
  `setUse(boolean use)`
  Sets whether to create class and package usage pages.
  `void`
  `setWindowTitle(@Nullable String windowTitle)`
  Sets the browser window title for the documentation.

  ### Methods inherited from class SourceTask

  `exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, source`

  ### Methods inherited from class org.gradle.api.internal.ConventionTask

  `conventionMapping, conventionMapping, getConventionMapping`

  ### Methods inherited from class DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

  ### Methods inherited from class org.gradle.api.internal.AbstractTask

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getLoggingManager, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, service, setImpliesSubProjects`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface Task

  `doNotTrackState, notCompatibleWithConfigurationCache, service`

- ## Constructor Details

  - ### Groovydoc

    @Inject public Groovydoc()

- ## Method Details

  - ### getWorkerExecutor

    @Inject protected abstract WorkerExecutor getWorkerExecutor()

  - ### getJavaToolchainService

    @Inject protected abstract JavaToolchainService getJavaToolchainService()

  - ### getObjectFactory

    @Inject protected abstract ObjectFactory getObjectFactory()

  - ### getJavaLauncher

    @Incubating public abstract Property<JavaLauncher> getJavaLauncher()
    The Java launcher used to start the worker process for generating Groovydoc.
    Since:
      9.7.0

  - ### getMaxMemory

    @Incubating @Internal public abstract Property<String> getMaxMemory()
    Returns the amount of memory allocated to this task. Ex. 512m, 1G
    Since:
      9.7.0

  - ### generate

    protected void generate()
    Generate.
    Since:
      0.8

  - ### getSource

    @PathSensitive(RELATIVE) public FileTree getSource()
    Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.

    The `PathSensitivity` for the sources is configured to be `PathSensitivity.ABSOLUTE`. If your sources are less strict, please change it accordingly by overriding this method in your subclass.

    Overrides:
      `getSource` in class `SourceTask`
    Returns:
      The source.

  - ### getDestinationDirectory

    @Incubating @OutputDirectory public abstract DirectoryProperty getDestinationDirectory()
    Returns the directory to generate the documentation into.
    Returns:
      The directory to generate the documentation into
    Since:
      9.7.0

  - ### getDestinationDir

    @ReplacedBy("destinationDirectory") public File getDestinationDir()
    Returns the directory to generate the documentation into.
    Returns:
      The directory to generate the documentation into
    Since:
      0.7

  - ### setDestinationDir

    public void setDestinationDir(File destinationDir)
    Sets the directory to generate the documentation into.
    Since:
      0.7

  - ### getGroovyClasspath

    @Classpath public FileCollection getGroovyClasspath()
    Returns the classpath containing the Groovy library to be used.
    Returns:
      The classpath containing the Groovy library to be used
    Since:
      0.7

  - ### setGroovyClasspath

    public void setGroovyClasspath(FileCollection groovyClasspath)
    Sets the classpath containing the Groovy library to be used.
    Since:
      0.7

  - ### getClasspath

    @Classpath public FileCollection getClasspath()
    Returns the classpath used to locate classes referenced by the documented sources.
    Returns:
      The classpath used to locate classes referenced by the documented sources
    Since:
      1.0

  - ### setClasspath

    public void setClasspath(FileCollection classpath)
    Sets the classpath used to locate classes referenced by the documented sources.
    Since:
      1.0

  - ### isUse

    @Input public boolean isUse()
    Returns whether to create class and package usage pages.
    Since:
      0.8

  - ### setUse

    public void setUse(boolean use)
    Sets whether to create class and package usage pages.
    Since:
      0.8

  - ### isNoTimestamp

    @Input public boolean isNoTimestamp()
    Returns whether to include timestamp within hidden comment in generated HTML (Groovy >= 2.4.6).
    Since:
      2.13

  - ### setNoTimestamp

    public void setNoTimestamp(boolean noTimestamp)
    Sets whether to include timestamp within hidden comment in generated HTML (Groovy >= 2.4.6).
    Since:
      2.13

  - ### isNoVersionStamp

    @Input public boolean isNoVersionStamp()
    Returns whether to include version stamp within hidden comment in generated HTML (Groovy >= 2.4.6).
    Since:
      2.13

  - ### setNoVersionStamp

    public void setNoVersionStamp(boolean noVersionStamp)
    Sets whether to include version stamp within hidden comment in generated HTML (Groovy >= 2.4.6).
    Since:
      2.13

  - ### getWindowTitle

    @Optional @Input public @Nullable String getWindowTitle()
    Returns the browser window title for the documentation. Set to `null` when there is no window title.
    Since:
      0.8

  - ### setWindowTitle

    public void setWindowTitle(@Nullable String windowTitle)
    Sets the browser window title for the documentation.
    Parameters:
      `windowTitle` - A text for the windows title
    Since:
      0.8

  - ### getDocTitle

    @Optional @Input public @Nullable String getDocTitle()
    Returns the title for the package index(first) page. Set to `null` when there is no document title.
    Since:
      0.8

  - ### setDocTitle

    public void setDocTitle(@Nullable String docTitle)
    Sets title for the package index(first) page (optional).
    Parameters:
      `docTitle` - the docTitle as HTML
    Since:
      0.8

  - ### getHeader

    @Optional @Input public @Nullable String getHeader()
    Returns the HTML header for each page. Set to `null` when there is no header.
    Since:
      0.8

  - ### setHeader

    public void setHeader(@Nullable String header)
    Sets header text for each page (optional).
    Parameters:
      `header` - the header as HTML
    Since:
      0.8

  - ### getFooter

    @Optional @Input public @Nullable String getFooter()
    Returns the HTML footer for each page. Set to `null` when there is no footer.
    Since:
      0.8

  - ### setFooter

    public void setFooter(@Nullable String footer)
    Sets footer text for each page (optional).
    Parameters:
      `footer` - the footer as HTML
    Since:
      0.8

  - ### getOverviewText

    @Optional public @Nullable TextResource getOverviewText()
    Returns a HTML text to be used for overview documentation. Set to `null` when there is no overview text.
    Since:
      2.14

  - ### setOverviewText

    public void setOverviewText(@Nullable TextResource overviewText)
    Sets a HTML text to be used for overview documentation (optional).

    Example: `overviewText = resources.text.fromFile("/overview.html")`

    Since:
      2.14

  - ### getAccess

    @Input public abstract Property<GroovydocAccess> getAccess()
    The most restrictive access level to include in the Groovydoc.

    For example, to include classes and members with package, protected, and public access, use `GroovydocAccess.PACKAGE`.

    Returns:
      the access property
    Since:
      7.5

  - ### getIncludeAuthor

    @Input public abstract Property<Boolean> getIncludeAuthor()
    Whether to include author paragraphs.
    Since:
      7.5

  - ### getProcessScripts

    @Input public abstract Property<Boolean> getProcessScripts()
    Whether to process scripts.
    Since:
      7.5

  - ### getIncludeMainForScripts

    @Input public abstract Property<Boolean> getIncludeMainForScripts()
    Whether to include main method for scripts.
    Since:
      7.5

  - ### getJavaVersion

    @Incubating @Optional @Input public abstract Property<JavaLanguageVersion> getJavaVersion()
    The Java language version used when parsing Java source files, e.g. `JavaLanguageVersion.of(17)`.

    Groovydoc uses the JavaParser library to read Java sources; this controls the source level it assumes, which is needed for parsing newer Java language constructs (for example, sealed classes require Java 17). When unset, Groovydoc uses the JavaParser library's own default.

    Only has an effect with Groovy 4.0.27 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getShowInternal

    @Incubating @Input public abstract Property<Boolean> getShowInternal()
    Whether to include members annotated with `groovy.transform.Internal` (per GEP-17) in the generated documentation.

    Defaults to `false`, so internal members are hidden. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getNoIndex

    @Incubating @Input public abstract Property<Boolean> getNoIndex()
    Whether to suppress generation of the alphabetical index page (`index-all.html`) and its nav-bar link.

    Defaults to `false`. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getNoDeprecatedList

    @Incubating @Input public abstract Property<Boolean> getNoDeprecatedList()
    Whether to suppress generation of the deprecated-list page (`deprecated-list.html`) and its nav-bar link.

    Defaults to `false`. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getNoHelp

    @Incubating @Input public abstract Property<Boolean> getNoHelp()
    Whether to suppress generation of the help page (`help-doc.html`) and its nav-bar link.

    Defaults to `false`. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getSyntaxHighlighter

    @Incubating @Input public abstract Property<String> getSyntaxHighlighter()
    The client-side syntax highlighter for `{@snippet}` and fenced Markdown code blocks.

    Valid values are `"prism"` (bundled) or `"none"` (default); any other value is treated as `"none"`. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getTheme

    @Incubating @Input public abstract Property<String> getTheme()
    The theme lock mode for the generated documentation.
    - `"auto"` (default) — emit a `prefers-color-scheme` media query so each reader sees their OS preference.
    - `"light"` — lock the palette to light regardless of OS.
    - `"dark"` — lock the palette to dark regardless of OS.
    Any other value is treated as `"auto"`. Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.
    Since:
      9.8.0

  - ### getPreLanguage

    @Incubating @Optional @Input public abstract Property<String> getPreLanguage()
    The default language id applied to preformatted code blocks in rendered doc comments that carry no `class` attribute.

    When set (for example, `"groovy"`), a post-pass adds `class="language-xxx"` to the opening tag of such blocks, enabling syntax highlighting for legacy doc-comment code blocks without touching source files. Blocks that already carry any `class` attribute are left alone.

    Only has an effect with Groovy 6.0.0 or later; the option is silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getAdditionalStylesheets

    @Incubating @InputFiles @PathSensitive(NAME_ONLY) public abstract ConfigurableFileCollection getAdditionalStylesheets()
    Additional stylesheets to copy into the generated documentation alongside the default stylesheet, preserving each file's name.

    Only has an effect with Groovy 6.0.0 or later; the stylesheets are silently ignored with earlier Groovy versions.

    Since:
      9.8.0

  - ### getLinks

    @Input public Set<Groovydoc.Link> getLinks()
    Returns the links to groovydoc/javadoc output at the given URL.
    Since:
      0.9

  - ### setLinks

    public void setLinks(Set<Groovydoc.Link> links)
    Sets links to groovydoc/javadoc output at the given URL.
    Parameters:
      `links` - The links to set
    Since:
      0.9
    See Also:
      - `link(String, String...)`

  - ### link

    public void link(String url, String... packages)
    Add links to groovydoc/javadoc output at the given URL.
    Parameters:
      `url` - Base URL of external site
      `packages` - list of package prefixes
    Since:
      0.9

  - ### getDeleter

    @Inject protected abstract org.gradle.internal.file.Deleter getDeleter()