Package: org.gradle.api.tasks.javadoc

## [Java] Class Javadoc

- org.gradle.api.tasks.javadoc.Javadoc

- 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:

       apply plugin: 'java'

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

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

       apply plugin: 'java'

       configurations {
         jaxDoclet
       }

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

       task generateRestApiDocs(type: Javadoc) {
         source = sourceSets.main.allJava
         destinationDir = reporting.file("rest-api-docs")
         options.docletpath = configurations.jaxDoclet.files.asType(List)
         options.doclet = "com.lunatech.doclets.jax.jaxrs.JAXRSDoclet"
         options.addStringOption("jaxrscontext", "http://localhost:8080/myapp")
       }

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class SourceTask` | `TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION`
    `class org.gradle.api.internal.ConventionTask` | `TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `protected void` | `generate()`
    `FileCollection` | `getClasspath()` Returns the classpath to use to resolve type references in the source code.
    `File` | `getDestinationDir()`
    `String` | `getExecutable()` Returns the Javadoc executable to use to generate the Javadoc.
    `String` | `getMaxMemory()` Returns the amount of memory allocated to this task.
    `MinimalJavadocOptions` | `getOptions()` Returns the Javadoc generation options.
    `File` | `getOptionsFile()`
    `String` | `getTitle()`
    `JavaToolChain` | `getToolChain()` Returns the tool chain that will be used to generate the Javadoc.
    `boolean` | `isFailOnError()` Specifies whether this task should fail when errors are encountered during Javadoc generation.
    `boolean` | `isVerbose()` Returns whether Javadoc generation is accompanied by verbose output.
    `void` | `options(groovy.lang.Closure<?> block)` Convenience method for configuring Javadoc generation options.
    `void` | `setClasspath(FileCollection classpath)` Sets the classpath to use to resolve type references in this source code.
    `void` | `setDestinationDir(File destinationDir)`
    `void` | `setExecutable(String executable)`
    `void` | `setFailOnError(boolean failOnError)`
    `void` | `setMaxMemory(String maxMemory)` Sets the amount of memory allocated to this task.
    `void` | `setOptions(MinimalJavadocOptions options)` Sets the Javadoc generation options.
    `void` | `setTitle(String title)`
    `void` | `setToolChain(JavaToolChain toolChain)` Sets the tool chain to use to generate the Javadoc.
    `void` | `setVerbose(boolean verbose)` Sets whether Javadoc generation is accompanied by verbose output or not.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class SourceTask` | `source, getSource, getIncludes, getExcludes, setSource, include, include, include, include, include, include, include, include, setIncludes, setIncludes, exclude, exclude, exclude, exclude, exclude, exclude, exclude, exclude, setExcludes, setExcludes, conventionMapping, conventionMapping, getConventionMapping, setProperty, toString, compareTo, compareTo, getName, getActions, getState, getState, setName, getPath, getExtensions, getLogger, execute, configure, configure, getDescription, leftShift, property, isEnabled, setEnabled, getOutputs, getOutputs, dependsOn, onlyIf, onlyIf, setOnlyIf, setOnlyIf, setDidWork, getDidWork, doFirst, doFirst, deleteAllActions, getProject, getTaskDependencies, getTaskDependencies, doLast, doLast, getEnabled, getAnt, getLogging, getLogging, hasProperty, getConvention, setDescription, getGroup, setGroup, dependsOnTaskDidWork, getInputs, getTemporaryDir, mustRunAfter, setMustRunAfter, getMustRunAfter, finalizedBy, setFinalizedBy, getFinalizedBy, shouldRunAfter, setShouldRunAfter, getShouldRunAfter, setActions, getDependsOn, setDependsOn, getStandardOutputCapture, getAsDynamicObject, setProject, addValidator, prependParallelSafeAction, injectIntoNewInstance, setImpliesSubProjects, getExecuter, setExecuter, getTemporaryDirFactory, getValidators, appendParallelSafeAction, isHasCustomActions, getTaskActions, getOnlyIf, getImpliesSubProjects, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll`
    `class org.gradle.api.internal.ConventionTask` | `org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, groovy.lang.Closure), org.gradle.api.internal.ConventionTask#conventionMapping(java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#getConventionMapping(), org.gradle.api.internal.ConventionTask#setProperty(java.lang.String, java.lang.Object), org.gradle.api.internal.ConventionTask#toString(), org.gradle.api.internal.ConventionTask#compareTo(java.lang.Object), org.gradle.api.internal.ConventionTask#compareTo(org.gradle.api.Task), org.gradle.api.internal.ConventionTask#getName(), org.gradle.api.internal.ConventionTask#getActions(), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#getState(), org.gradle.api.internal.ConventionTask#setName(java.lang.String), org.gradle.api.internal.ConventionTask#getPath(), org.gradle.api.internal.ConventionTask#getExtensions(), org.gradle.api.internal.ConventionTask#getLogger(), org.gradle.api.internal.ConventionTask#execute(), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#configure(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#getDescription(), org.gradle.api.internal.ConventionTask#leftShift(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#property(java.lang.String), org.gradle.api.internal.ConventionTask#isEnabled(), org.gradle.api.internal.ConventionTask#setEnabled(boolean), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#getOutputs(), org.gradle.api.internal.ConventionTask#dependsOn([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#onlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#onlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(org.gradle.api.specs.Spec), org.gradle.api.internal.ConventionTask#setOnlyIf(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#setDidWork(boolean), org.gradle.api.internal.ConventionTask#getDidWork(), org.gradle.api.internal.ConventionTask#doFirst(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#doFirst(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#deleteAllActions(), org.gradle.api.internal.ConventionTask#getProject(), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#getTaskDependencies(), org.gradle.api.internal.ConventionTask#doLast(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#doLast(groovy.lang.Closure), org.gradle.api.internal.ConventionTask#getEnabled(), org.gradle.api.internal.ConventionTask#getAnt(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#getLogging(), org.gradle.api.internal.ConventionTask#hasProperty(java.lang.String), org.gradle.api.internal.ConventionTask#getConvention(), org.gradle.api.internal.ConventionTask#setDescription(java.lang.String), org.gradle.api.internal.ConventionTask#getGroup(), org.gradle.api.internal.ConventionTask#setGroup(java.lang.String), org.gradle.api.internal.ConventionTask#dependsOnTaskDidWork(), org.gradle.api.internal.ConventionTask#getInputs(), org.gradle.api.internal.ConventionTask#getTemporaryDir(), org.gradle.api.internal.ConventionTask#mustRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setMustRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getMustRunAfter(), org.gradle.api.internal.ConventionTask#finalizedBy([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setFinalizedBy(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getFinalizedBy(), org.gradle.api.internal.ConventionTask#shouldRunAfter([Ljava.lang.Object;), org.gradle.api.internal.ConventionTask#setShouldRunAfter(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getShouldRunAfter(), org.gradle.api.internal.ConventionTask#setActions(java.util.List), org.gradle.api.internal.ConventionTask#getDependsOn(), org.gradle.api.internal.ConventionTask#setDependsOn(java.lang.Iterable), org.gradle.api.internal.ConventionTask#getStandardOutputCapture(), org.gradle.api.internal.ConventionTask#getAsDynamicObject(), org.gradle.api.internal.ConventionTask#setProject(org.gradle.api.Project), org.gradle.api.internal.ConventionTask#addValidator(org.gradle.api.internal.tasks.execution.TaskValidator), org.gradle.api.internal.ConventionTask#prependParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#injectIntoNewInstance(org.gradle.api.internal.project.ProjectInternal, java.lang.String, java.util.concurrent.Callable), org.gradle.api.internal.ConventionTask#setImpliesSubProjects(boolean), org.gradle.api.internal.ConventionTask#getExecuter(), org.gradle.api.internal.ConventionTask#setExecuter(org.gradle.api.internal.tasks.TaskExecuter), org.gradle.api.internal.ConventionTask#getTemporaryDirFactory(), org.gradle.api.internal.ConventionTask#getValidators(), org.gradle.api.internal.ConventionTask#appendParallelSafeAction(org.gradle.api.Action), org.gradle.api.internal.ConventionTask#isHasCustomActions(), org.gradle.api.internal.ConventionTask#getTaskActions(), org.gradle.api.internal.ConventionTask#getOnlyIf(), org.gradle.api.internal.ConventionTask#getImpliesSubProjects(), org.gradle.api.internal.ConventionTask#wait(long, int), org.gradle.api.internal.ConventionTask#wait(long), org.gradle.api.internal.ConventionTask#wait(), org.gradle.api.internal.ConventionTask#equals(java.lang.Object), org.gradle.api.internal.ConventionTask#hashCode(), org.gradle.api.internal.ConventionTask#getClass(), org.gradle.api.internal.ConventionTask#notify(), org.gradle.api.internal.ConventionTask#notifyAll()`

- - ### Method Detail

    - #### @TaskAction protected void generate()

    - #### @InputFiles public FileCollection getClasspath()

      Returns the classpath to use to resolve type references in the source code.

      Returns:
        The classpath.

    - #### @OutputDirectory public File getDestinationDir()

      Returns the directory to generate the documentation into.

      Returns:
        The directory.

    - #### @Input @Optional public String getExecutable()

      Returns the Javadoc executable to use to generate the Javadoc. When `null`, the Javadoc executable for the current JVM is used.

      Returns:
        The executable. May be null.

    - #### public String getMaxMemory()

      Returns the amount of memory allocated to this task.

    - #### @Nested public MinimalJavadocOptions getOptions()

      Returns the Javadoc generation options.

      Returns:
        The options. Never returns null.

    - #### public File getOptionsFile()

    - #### @Input @Optional public String getTitle()

      Returns the title for the generated documentation.

      Returns:
        The title, possibly null.

    - #### @Incubating @javax.inject.Inject public JavaToolChain getToolChain()

      Returns the tool chain that will be used to generate the Javadoc.

    - #### @Input public boolean isFailOnError()

      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.

    - #### public boolean isVerbose()

      Returns whether Javadoc generation is accompanied by verbose output.

      See Also:
        setVerbose(boolean)

    - #### public void options(groovy.lang.Closure<?> block)

      Convenience method for configuring Javadoc generation options.

      Parameters:
        `block` - The configuration block for Javadoc generation options.

    - #### public void setClasspath(FileCollection classpath)

      Sets the classpath to use to resolve type references in this source code.

      Parameters:
        `classpath` - The classpath. Must not be null.

    - #### public void setDestinationDir(File destinationDir)

      Sets the directory to generate the documentation into.

    - #### public void setExecutable(String executable)

    - #### public void setFailOnError(boolean failOnError)

    - #### public void setMaxMemory(String maxMemory)

      Sets the amount of memory allocated to this task.

      Parameters:
        `maxMemory` - The amount of memory

    - #### public void setOptions(MinimalJavadocOptions options)

      Sets the Javadoc generation options.

      Parameters:
        `options` - The options. Must not be null.

    - #### public void setTitle(String title)

      Sets the title for the generated documentation.

    - #### @Incubating public void setToolChain(JavaToolChain toolChain)

      Sets the tool chain to use to generate the Javadoc.

    - #### public void setVerbose(boolean verbose)

      Sets whether Javadoc generation is accompanied by verbose output or not. The verbose output is done via println (by the underlying Ant task). Thus it is not handled by our logging.

      Parameters:
        `verbose` - Whether the output should be verbose.