1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
[//]: # (title: Javadoc)
> The Javadoc output format is still in Alpha, so you may find bugs and experience migration issues when using it.
> Successful integration with tools that accept Java's Javadoc HTML as input is not guaranteed.
> **You use it at your own risk.**
>
{type="warning"}
Dokka's Javadoc output format is a lookalike of Java's
[Javadoc HTML format](https://docs.oracle.com/en/java/javase/19/docs/api/index.html).
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](javadoc-format-example.png){width=706}
All Kotlin code and signatures are rendered as seen from Java's perspective. This is achieved with our
[Kotlin as Java Dokka plugin](https://github.com/Kotlin/dokka/tree/master/plugins/kotlin-as-java), which comes bundled and
applied by default for this format.
The Javadoc output format is implemented as a [Dokka plugin](dokka-plugins.md), and it is maintained by the Dokka team.
It is open source and you can find the source code on [GitHub](https://github.com/Kotlin/dokka/tree/master/plugins/javadoc).
## Generate Javadoc documentation
> The Javadoc format does not support multiplatform projects.
>
{type="warning"}
<tabs group="build-script">
<tab title="Gradle" group-key="kotlin">
The [Gradle plugin for Dokka](dokka-gradle.md) 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`](dokka-gradle.md#collector-tasks) 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`](dokka-gradle.md#build-javadoc-jar).
</tab>
<tab title="Maven" group-key="groovy">
The [Maven plugin for Dokka](dokka-maven.md) 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 |
</tab>
<tab title="CLI" group-key="cli">
Since the Javadoc output format is a [Dokka plugin](dokka-plugins.md#apply-dokka-plugins), you need to
[download the plugin's JAR file](https://repo1.maven.org/maven2/org/jetbrains/dokka/javadoc-plugin/%dokkaVersion%/javadoc-plugin-%dokkaVersion%.jar).
The Javadoc output format has two dependencies that you need to provide as additional JAR files:
* [kotlin-as-java plugin](https://repo1.maven.org/maven2/org/jetbrains/dokka/kotlin-as-java-plugin/%dokkaVersion%/kotlin-as-java-plugin-%dokkaVersion%.jar)
* [korte-jvm](https://repo1.maven.org/maven2/com/soywiz/korlibs/korte/korte-jvm/3.3.0/korte-jvm-3.3.0.jar)
Via [command line options](dokka-cli.md#run-with-command-line-options):
```Bash
java -jar dokka-cli-%dokkaVersion%.jar \
-pluginsClasspath "./dokka-base-%dokkaVersion%.jar;...;./javadoc-plugin-%dokkaVersion%.jar" \
...
```
Via [JSON configuration](dokka-cli.md#run-with-json-configuration):
```json
{
...
"pluginsClasspath": [
"./dokka-base-%dokkaVersion%.jar",
"...",
"./kotlin-as-java-plugin-%dokkaVersion%.jar",
"./korte-jvm-3.3.0.jar",
"./javadoc-plugin-%dokkaVersion%.jar"
],
...
}
```
For more information, see [Other output formats](dokka-cli.md#other-output-formats) in the CLI runner's documentation.
</tab>
</tabs>
|