api / org.gradle.api.tasks.javadoc / Javadoc

Javadoc

@CacheableTask open class Javadoc : 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:

 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") } 

Constructors

<init>

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") } 

Functions

getClasspath

open fun getClasspath(): FileCollection

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

getDestinationDir

open fun getDestinationDir(): File

Returns the directory to generate the documentation into.

getExecutable

open fun getExecutable(): String

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

getMaxMemory

open fun getMaxMemory(): String

Returns the amount of memory allocated to this task.

getOptions

open fun getOptions(): MinimalJavadocOptions

Returns the Javadoc generation options.

getOptionsFile

open fun getOptionsFile(): File

getSource

open fun getSource(): FileTree

{@inheritDoc}

getTitle

open fun getTitle(): String

Returns the title for the generated documentation.

getToolChain

open fun getToolChain(): JavaToolChain

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

isFailOnError

open fun isFailOnError(): Boolean

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.

isVerbose

open fun isVerbose(): Boolean

Returns whether Javadoc generation is accompanied by verbose output.

options

open fun options(block: Closure<*>): Unit
open fun options(action: Action<in MinimalJavadocOptions>): Unit

Convenience method for configuring Javadoc generation options.

setClasspath

open fun setClasspath(classpath: FileCollection): Unit

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

setDestinationDir

open fun setDestinationDir(destinationDir: File): Unit

Sets the directory to generate the documentation into.

setExecutable

open fun setExecutable(executable: String): Unit

setFailOnError

open fun setFailOnError(failOnError: Boolean): Unit

setMaxMemory

open fun setMaxMemory(maxMemory: String): Unit

Sets the amount of memory allocated to this task.

setTitle

open fun setTitle(title: String): Unit

Sets the title for the generated documentation.

setToolChain

open fun setToolChain(toolChain: JavaToolChain): Unit

Sets the tool chain to use to generate the Javadoc.

setVerbose

open fun setVerbose(verbose: Boolean): Unit

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.

Inherited Functions

exclude

open fun exclude(vararg excludes: String): SourceTask
open fun exclude(excludes: MutableIterable<String>): SourceTask
open fun exclude(excludeSpec: Spec<FileTreeElement>): SourceTask
open fun exclude(excludeSpec: Closure<Any>): SourceTask

{@inheritDoc}

getExcludes

open fun getExcludes(): MutableSet<String>

{@inheritDoc}

getIncludes

open fun getIncludes(): MutableSet<String>

{@inheritDoc}

include

open fun include(vararg includes: String): SourceTask
open fun include(includes: MutableIterable<String>): SourceTask
open fun include(includeSpec: Spec<FileTreeElement>): SourceTask
open fun include(includeSpec: Closure<Any>): SourceTask

{@inheritDoc}

setExcludes

open fun setExcludes(excludes: MutableIterable<String>): SourceTask

{@inheritDoc}

setIncludes

open fun setIncludes(includes: MutableIterable<String>): SourceTask

{@inheritDoc}

setSource

open fun setSource(source: FileTree): Unit

Sets the source for this task.

open fun setSource(source: Any): Unit

Sets the source for this task. The given source object is evaluated as per org.gradle.api.Project#files(Object...).

source

open fun source(vararg sources: Any): SourceTask

Adds some source to this task. The given source objects will be evaluated as per org.gradle.api.Project#files(Object...).