java.lang.Comparable<Task>
, org.gradle.api.internal.DynamicObjectAware
, org.gradle.api.internal.IConventionAware
, org.gradle.api.internal.TaskInternal
, 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 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") }
Task.Namer
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
Javadoc() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
generate() |
|
FileCollection |
getClasspath() |
Returns the classpath to use to resolve type references in the source code.
|
protected org.gradle.internal.file.Deleter |
getDeleter() |
|
java.io.File |
getDestinationDir() |
Returns the directory to generate the documentation into.
|
java.lang.String |
getExecutable() |
Returns the Javadoc executable to use to generate the Javadoc.
|
Property<JavadocTool> |
getJavadocTool() |
Configures the javadoc executable to be used to generate javadoc documentation.
|
protected org.gradle.internal.jvm.JavaModuleDetector |
getJavaModuleDetector() |
|
protected JavaToolchainService |
getJavaToolchainService() |
|
java.lang.String |
getMaxMemory() |
Returns the amount of memory allocated to this task.
|
ModularitySpec |
getModularity() |
Returns the module path handling of this javadoc task.
|
protected ObjectFactory |
getObjectFactory() |
|
MinimalJavadocOptions |
getOptions() |
Returns the Javadoc generation options.
|
java.io.File |
getOptionsFile() |
|
protected java.io.File |
getOutputDirectory() |
|
protected ProjectLayout |
getProjectLayout() |
|
protected ProviderFactory |
getProviderFactory() |
|
FileTree |
getSource() |
Returns the source for this task, after the include and exclude patterns have been applied.
|
java.lang.String |
getTitle() |
Returns the title for the generated documentation.
|
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(Closure<?> block) |
Convenience method for configuring Javadoc generation options.
|
void |
options(Action<? super MinimalJavadocOptions> action) |
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(java.io.File destinationDir) |
Sets the directory to generate the documentation into.
|
void |
setExecutable(java.lang.String executable) |
|
void |
setFailOnError(boolean failOnError) |
|
void |
setMaxMemory(java.lang.String maxMemory) |
Sets the amount of memory allocated to this task.
|
void |
setTitle(java.lang.String title) |
Sets the title for the generated documentation.
|
void |
setVerbose(boolean verbose) |
Sets whether Javadoc generation is accompanied by verbose output or not.
|
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, source
conventionMapping, conventionMapping, getConventionMapping
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
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
protected void generate()
@PathSensitive(RELATIVE) public FileTree getSource()
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.
getSource
in class SourceTask
public Property<JavadocTool> getJavadocTool()
@Internal @Nullable public java.io.File getDestinationDir()
Returns the directory to generate the documentation into.
@OutputDirectory protected java.io.File getOutputDirectory()
public void setDestinationDir(java.io.File destinationDir)
Sets the directory to generate the documentation into.
@Internal @Nullable public java.lang.String getMaxMemory()
public void setMaxMemory(java.lang.String maxMemory)
maxMemory
- The amount of memory@Nullable @Optional @Input public java.lang.String getTitle()
Returns the title for the generated documentation.
public void setTitle(@Nullable java.lang.String title)
Sets the title for the generated documentation.
@Internal public boolean isVerbose()
setVerbose(boolean)
public void setVerbose(boolean verbose)
verbose
- Whether the output should be verbose.@Classpath public FileCollection getClasspath()
public void setClasspath(FileCollection classpath)
classpath
- The classpath. Must not be null.public ModularitySpec getModularity()
public MinimalJavadocOptions getOptions()
public void options(@DelegatesTo(MinimalJavadocOptions.class) Closure<?> block)
block
- The configuration block for Javadoc generation options.public void options(Action<? super MinimalJavadocOptions> action)
action
- The action for Javadoc generation options.@Input public boolean isFailOnError()
true
,
this task will fail on Javadoc error. When false
, this task will ignore Javadoc errors.public void setFailOnError(boolean failOnError)
@Internal public java.io.File getOptionsFile()
@Nullable @Optional @Input public java.lang.String getExecutable()
null
, the Javadoc executable for
the current JVM is used or from the toolchain if configured.getJavadocTool()
public void setExecutable(@Nullable java.lang.String executable)
@Inject protected org.gradle.internal.file.Deleter getDeleter()
@Inject protected ProjectLayout getProjectLayout()
@Inject protected ObjectFactory getObjectFactory()
@Inject protected org.gradle.internal.jvm.JavaModuleDetector getJavaModuleDetector()
@Inject protected JavaToolchainService getJavaToolchainService()
@Inject protected ProviderFactory getProviderFactory()