Kotlin Help

Javadoc

Dokka's Javadoc output format is a lookalike of Java's Javadoc HTML format.

It tries to visually mimic HTML pages generated by the Javadoc tool, but it's not a direct implementation or an exact copy.

Screenshot of javadoc output format

All Kotlin code and signatures are rendered as seen from Java's perspective. This is achieved with our Kotlin as Java Dokka plugin, which comes bundled and applied by default for this format.

The Javadoc output format is implemented as a Dokka plugin, and it is maintained by the Dokka team. It is open source and you can find the source code on GitHub.

Generate Javadoc documentation

The Gradle plugin for Dokka comes with the Javadoc output format included. You can use the following tasks:

Task

Description

dokkaJavadoc

Generates Javadoc documentation for a single project.

dokkaJavadocCollector

A Collector task created only for parent projects in multi-project builds. It calls dokkaJavadoc for every subproject and merges all outputs into a single virtual project.

The javadoc.jar file can be generated separately. For more information, see Building javadoc.jar.

The Maven plugin for Dokka comes with the Javadoc output format built in. You can generate documentation by using the following goals:

Goal

Description

dokka:javadoc

Generates documentation in Javadoc format

dokka:javadocJar

Generates a javadoc.jar file that contains documentation in Javadoc format

Since the Javadoc output format is a Dokka plugin, you need to download the plugin's JAR file.

The Javadoc output format has two dependencies that you need to provide as additional JAR files:

Via command line options:

java -jar dokka-cli-1.9.20.jar \ -pluginsClasspath "./dokka-base-1.9.20.jar;...;./javadoc-plugin-1.9.20.jar" \ ...

Via JSON configuration:

{ ... "pluginsClasspath": [ "./dokka-base-1.9.20.jar", "...", "./kotlin-as-java-plugin-1.9.20.jar", "./korte-jvm-3.3.0.jar", "./javadoc-plugin-1.9.20.jar" ], ... }

For more information, see Other output formats in the CLI runner's documentation.

Last modified: 03 December 2024