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>
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
   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")
 }
 - 
Nested Class SummaryNested classes/interfaces inherited from interface org.gradle.api.TaskTask.Namer
- 
Field SummaryFields inherited from interface org.gradle.api.TaskTASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidgenerate()Returns the classpath to use to resolve type references in the source code.protected org.gradle.internal.file.DeleterReturns the directory to generate the documentation into.Returns the Javadoc executable to use to generate the Javadoc.Configures the javadoc executable to be used to generate javadoc documentation.protected org.gradle.internal.jvm.JavaModuleDetectorprotected JavaToolchainServiceReturns the amount of memory allocated to this task.Returns the module path handling of this javadoc task.protected ObjectFactoryReturns the Javadoc generation options.protected Fileprotected ProjectLayoutprotected org.gradle.api.internal.provider.PropertyFactoryprotected ProviderFactoryReturns the source for this task, after the include and exclude patterns have been applied.getTitle()Returns the title for the generated documentation.booleanSpecifies whether this task should fail when errors are encountered during Javadoc generation.booleanDeprecated.voidConvenience method for configuring Javadoc generation options.voidoptions(Action<? super MinimalJavadocOptions> action) Convenience method for configuring Javadoc generation options.voidsetClasspath(FileCollection classpath) Sets the classpath to use to resolve type references in this source code.voidsetDestinationDir(File destinationDir) Sets the directory to generate the documentation into.voidsetExecutable(String executable) voidsetFailOnError(boolean failOnError) voidsetMaxMemory(String maxMemory) Sets the amount of memory allocated to this task.voidSets the title for the generated documentation.voidsetVerbose(boolean verbose) Deprecated.This method duplicates the functionality ofgetOptions().verbose().Methods inherited from class org.gradle.api.tasks.SourceTaskexclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, sourceMethods inherited from class org.gradle.api.internal.ConventionTaskconventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.DefaultTaskcompareTo, 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, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTaskacceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.TaskdoNotTrackState, getConvention, notCompatibleWithConfigurationCache
- 
Constructor Details- 
Javadocpublic Javadoc()
 
- 
- 
Method Details- 
generateprotected void generate()
- 
getSourceReturns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.The PathSensitivityfor the sources is configured to bePathSensitivity.ABSOLUTE. If your sources are less strict, please change it accordingly by overriding this method in your subclass.- Overrides:
- getSourcein class- SourceTask
- Returns:
- The source.
 
- 
getJavadocToolConfigures the javadoc executable to be used to generate javadoc documentation.- Since:
- 6.7
 
- 
getDestinationDirReturns the directory to generate the documentation into. - Returns:
- The directory.
 
- 
getOutputDirectory
- 
setDestinationDirSets the directory to generate the documentation into. 
- 
getMaxMemoryReturns the amount of memory allocated to this task.
- 
setMaxMemorySets the amount of memory allocated to this task.- Parameters:
- maxMemory- The amount of memory
 
- 
getTitleReturns the title for the generated documentation. - Returns:
- The title, possibly null.
 
- 
setTitleSets the title for the generated documentation. 
- 
isVerboseDeprecated.This method duplicates the functionality ofgetOptions().isVerbose(). It will be removed in Gradle 9.0.Returns whether Javadoc generation is accompanied by verbose output.- See Also:
 
- 
setVerboseDeprecated.This method duplicates the functionality ofgetOptions().verbose(). It will be removed in Gradle 9.0.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.
 
- 
getClasspathReturns the classpath to use to resolve type references in the source code.- Returns:
- The classpath.
 
- 
setClasspathSets the classpath to use to resolve type references in this source code.- Parameters:
- classpath- The classpath. Must not be null.
 
- 
getModularityReturns the module path handling of this javadoc task.- Since:
- 6.4
 
- 
getOptionsReturns the Javadoc generation options.- Returns:
- The options. Never returns null.
 
- 
optionsConvenience method for configuring Javadoc generation options.- Parameters:
- block- The configuration block for Javadoc generation options.
 
- 
optionsConvenience method for configuring Javadoc generation options.- Parameters:
- action- The action for Javadoc generation options.
- Since:
- 3.5
 
- 
isFailOnErrorSpecifies whether this task should fail when errors are encountered during Javadoc generation. Whentrue, this task will fail on Javadoc error. Whenfalse, this task will ignore Javadoc errors.
- 
setFailOnErrorpublic void setFailOnError(boolean failOnError) 
- 
getOptionsFile
- 
getExecutableReturns the Javadoc executable to use to generate the Javadoc. Whennull, the Javadoc executable for the current JVM is used or from the toolchain if configured.- Returns:
- The executable. May be null.
- See Also:
 
- 
setExecutable
- 
getDeleter@Inject protected org.gradle.internal.file.Deleter getDeleter()
- 
getProjectLayout
- 
getObjectFactory
- 
getPropertyFactory@Inject protected org.gradle.api.internal.provider.PropertyFactory getPropertyFactory()
- 
getJavaModuleDetector@Inject protected org.gradle.internal.jvm.JavaModuleDetector getJavaModuleDetector()
- 
getJavaToolchainService
- 
getProviderFactory
 
- 
getOptions().isVerbose().