Package org.gradle.api.tasks.javadoc

# Class Javadoc

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.Javadoc

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 Javadoc extends SourceTask

Generates HTML API documentation for Java classes.

If you create your own Javadoc tasks remember to specify the 'source' property! Without source the Javadoc task will not create any documentation. Example:

     plugins {
         id 'java'
     }

     task myJavadocs(type: Javadoc) {
       source = sourceSets.main.allJava
     }

An example how to create a task that runs a custom doclet implementation:

     plugins {
         id 'java'
     }

     configurations {
       jaxDoclet
     }

     dependencies {
       // jaxDoclet "some.interesting:Dependency:1.0"
     }

     task generateRestApiDocs(type: Javadoc) {
       source = sourceSets.main.allJava

       options.docletpath = configurations.jaxDoclet
       options.doclet = "com.lunatech.doclets.jax.jaxrs.JAXRSDoclet"
       options.addStringOption("jaxrscontext", "http://localhost:8080/myapp")
     }

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `(package private) static class`
  `Javadoc.OutputDirectoryAdapter`

  ## Nested classes/interfaces inherited from interface org.gradle.api.Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface org.gradle.api.Task

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Javadoc()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `generate()`
  `abstract ConfigurableFileCollection`
  `getClasspath()`
  Returns the classpath to use to resolve type references in the source code.
  `protected abstract org.gradle.internal.file.Deleter`
  `getDeleter()`
  `abstract DirectoryProperty`
  `getDestinationDir()`
  Returns the directory to generate the documentation into.
  `abstract Property<String>`
  `getExecutable()`
  Returns the Javadoc executable to use to generate the Javadoc.
  `abstract Property<Boolean>`
  `getFailOnError()`
  Specifies whether this task should fail when errors are encountered during Javadoc generation.
  `Property<Boolean>`
  `getIsFailOnError()`
  `abstract Property<JavadocTool>`
  `getJavadocTool()`
  Configures the javadoc executable to be used to generate javadoc documentation.
  `protected abstract org.gradle.internal.jvm.JavaModuleDetector`
  `getJavaModuleDetector()`
  `protected abstract JavaToolchainService`
  `getJavaToolchainService()`
  `abstract Property<String>`
  `getMaxMemory()`
  Returns the amount of memory allocated to this task.
  `ModularitySpec`
  `getModularity()`
  Returns the module path handling of this javadoc task.
  `protected abstract ObjectFactory`
  `getObjectFactory()`
  `MinimalJavadocOptions`
  `getOptions()`
  Returns the Javadoc generation options.
  `Provider<RegularFile>`
  `getOptionsFile()`
  `protected Provider<Directory>`
  `getOutputDirectory()`
  `protected abstract ProjectLayout`
  `getProjectLayout()`
  `protected abstract org.gradle.api.internal.provider.PropertyFactory`
  `getPropertyFactory()`
  `protected abstract ProviderFactory`
  `getProviderFactory()`
  `FileTree`
  `getSource()`
  Returns the source for this task, after the include and exclude patterns have been applied.
  `abstract Property<String>`
  `getTitle()`
  Returns the title for the generated documentation.
  `void`
  `options(Closure<?> block)`
  Convenience method for configuring Javadoc generation options.
  `void`
  `options(Action<? super MinimalJavadocOptions> action)`
  Convenience method for configuring Javadoc generation options.

  ### Methods inherited from class org.gradle.api.tasks.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 org.gradle.api.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, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects`

  ### Methods inherited from class java.lang.Object

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

  ### Methods inherited from interface org.gradle.api.Task

  `doNotTrackState, notCompatibleWithConfigurationCache`

- ## Constructor Details

  - ### Javadoc

    public Javadoc()

- ## Method Details

  - ### 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.

  - ### getJavadocTool

    public abstract Property<JavadocTool> getJavadocTool()
    Configures the javadoc executable to be used to generate javadoc documentation.
    Since:
      6.7

  - ### getDestinationDir

    @Internal public abstract DirectoryProperty getDestinationDir()

    Returns the directory to generate the documentation into.

    Returns:
      The directory.

  - ### getOutputDirectory

    @OutputDirectory protected Provider<Directory> getOutputDirectory()

  - ### getMaxMemory

    @Internal public abstract Property<String> getMaxMemory()
    Returns the amount of memory allocated to this task.

  - ### getTitle

    @Optional @Input public abstract Property<String> getTitle()

    Returns the title for the generated documentation.

    Returns:
      The title, possibly null.

  - ### getClasspath

    @Classpath public abstract ConfigurableFileCollection getClasspath()
    Returns the classpath to use to resolve type references in the source code.
    Returns:
      The classpath.

  - ### getModularity

    public ModularitySpec getModularity()
    Returns the module path handling of this javadoc task.
    Since:
      6.4

  - ### getOptions

    public MinimalJavadocOptions getOptions()
    Returns the Javadoc generation options.
    Returns:
      The options. Never returns null.

  - ### options

    public void options(@DelegatesTo(MinimalJavadocOptions.class) Closure<?> block)
    Convenience method for configuring Javadoc generation options.
    Parameters:
      `block` - The configuration block for Javadoc generation options.

  - ### options

    public void options(Action<? super MinimalJavadocOptions> action)
    Convenience method for configuring Javadoc generation options.
    Parameters:
      `action` - The action for Javadoc generation options.
    Since:
      3.5

  - ### getFailOnError

    @Input public abstract Property<Boolean> getFailOnError()
    Specifies whether this task should fail when errors are encountered during Javadoc generation. When `true`, this task will fail on Javadoc error. When `false`, this task will ignore Javadoc errors.

  - ### getIsFailOnError

    @ReplacedBy("getFailOnError()") public Property<Boolean> getIsFailOnError()

  - ### getOptionsFile

    @Internal public Provider<RegularFile> getOptionsFile()

  - ### getExecutable

    @Optional @Input public abstract Property<String> getExecutable()
    Returns the Javadoc executable to use to generate the Javadoc. When `null`, the Javadoc executable for the current JVM is used or from the toolchain if configured.
    Returns:
      The executable. May be null.
    See Also:
      - `getJavadocTool()`

  - ### getDeleter

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

  - ### getProjectLayout

    @Inject protected abstract ProjectLayout getProjectLayout()

  - ### getObjectFactory

    @Inject protected abstract ObjectFactory getObjectFactory()

  - ### getPropertyFactory

    @Inject protected abstract org.gradle.api.internal.provider.PropertyFactory getPropertyFactory()

  - ### getJavaModuleDetector

    @Inject protected abstract org.gradle.internal.jvm.JavaModuleDetector getJavaModuleDetector()

  - ### getJavaToolchainService

    @Inject protected abstract JavaToolchainService getJavaToolchainService()

  - ### getProviderFactory

    @Inject protected abstract ProviderFactory getProviderFactory()