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.

  • 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()
    • 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
    • setDestinationDir

      public void setDestinationDir(File destinationDir)
      Sets the directory to generate the documentation into.
    • 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
    • setGroovyClasspath

      public void setGroovyClasspath(FileCollection groovyClasspath)
      Sets the classpath containing the Groovy library to be used.
    • 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
    • setClasspath

      public void setClasspath(FileCollection classpath)
      Sets the classpath used to locate classes referenced by the documented sources.
    • isUse

      @Input public boolean isUse()
      Returns whether to create class and package usage pages.
    • setUse

      public void setUse(boolean use)
      Sets whether to create class and package usage pages.
    • isNoTimestamp

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

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

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

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

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

      public void setWindowTitle(@Nullable String windowTitle)
      Sets the browser window title for the documentation.
      Parameters:
      windowTitle - A text for the windows title
    • 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.
    • setDocTitle

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

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

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

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

      public void setFooter(@Nullable String footer)
      Sets footer text for each page (optional).
      Parameters:
      footer - the footer as HTML
    • 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.
    • 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")

    • 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.
    • setLinks

      public void setLinks(Set<Groovydoc.Link> links)
      Sets links to groovydoc/javadoc output at the given URL.
      Parameters:
      links - The links to set
      See Also:
    • 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
    • getDeleter

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