You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/dokka-migration.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Update the Dokka version to 2.0.0 in the `plugins {}` block of your project’s
43
43
```kotlin
44
44
plugins {
45
45
kotlin("jvm") version "2.1.10"
46
-
id("org.jetbrains.dokka") version "2.0.0"
46
+
id("org.jetbrains.dokka") version "%dokkaVersion%"
47
47
}
48
48
```
49
49
@@ -525,15 +525,15 @@ For an example of the DGP v2 configuration, see the
525
525
DGP v2 allows you to extend its functionality by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/ae3840edb4e4afd7b3e3768a5fddfe8ec0e08f31/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
526
526
Custom plugins enable additional processing or modifications to the documentation generation process.
527
527
528
-
### Share Dokka configuration across modules
528
+
### Share Dokka configuration across subprojects
529
529
530
-
DPG v2 moves away from using `subprojects {}` or `allprojects {}` to share configuration across modules. In future Gradle versions,
530
+
DPG v2 moves away from using `subprojects {}` or `allprojects {}` to share configuration across subprojects. In future Gradle versions,
531
531
using these approaches will [lead to errors](https://docs.gradle.org/current/userguide/isolated_projects.html).
532
532
533
533
Follow the steps below to properly share Dokka configuration in multi-module projects [with existing convention plugins](#multi-module-projects-with-convention-plugins)
534
534
or [without convention plugins](#multi-module-projects-without-convention-plugins).
535
535
536
-
After sharing the Dokka configuration, you can aggregate the documentation from multiple modules into a single output. For more information, see
536
+
After sharing the Dokka configuration, you can aggregate the documentation from multiple subprojects into a single output. For more information, see
537
537
[Update documentation aggregation in multi-module projects](#update-documentation-aggregation-in-multi-module-projects).
538
538
539
539
> For a multi-module project example, see the [Dokka GitHub repository](https://github.com/Kotlin/dokka/tree/master/examples/gradle-v2/multimodule-example).
@@ -542,12 +542,12 @@ After sharing the Dokka configuration, you can aggregate the documentation from
542
542
543
543
#### Multi-module projects without convention plugins
544
544
545
-
If your project doesn't use convention plugins, you can still share Dokka configurations by directly configuring each module.
546
-
This involves manually setting up the shared configuration in each module's `build.gradle.kts` file. While this approach is less centralized,
545
+
If your project doesn't use convention plugins, you can still share Dokka configurations by directly configuring each subproject.
546
+
This involves manually setting up the shared configuration in each subproject's `build.gradle.kts` file. While this approach is less centralized,
547
547
it avoids the need for additional setups like convention plugins.
548
548
549
549
Otherwise, if your project uses convention plugins, you can also share the Dokka configuration in multi-module projects
550
-
by creating a convention plugin in the `buildSrc` directory, and then applying the plugin to your modules (subprojects).
550
+
by creating a convention plugin in the `buildSrc` directory, and then applying the plugin to your subprojects.
551
551
552
552
##### Set up the buildSrc directory
553
553
@@ -599,9 +599,9 @@ After setting up the `buildSrc` directory:
599
599
You need to add the shared Dokka [configuration](#adjust-configuration-options) common to all subprojects within the `dokka {}` block.
600
600
Also, you don't need to specify a Dokka version. The version is already set in the `buildSrc/build.gradle.kts` file.
601
601
602
-
##### Apply the convention plugin to your modules
602
+
##### Apply the convention plugin to your subprojects
603
603
604
-
Apply the Dokka convention plugin across your modules (subprojects) by adding it to each subproject's `build.gradle.kts` file:
604
+
Apply the Dokka convention plugin across your subprojects by adding it to each subproject's `build.gradle.kts` file:
605
605
606
606
```kotlin
607
607
plugins {
@@ -614,13 +614,13 @@ plugins {
614
614
If you already have convention plugins, create a dedicated Dokka convention plugin following [Gradle's documentation](https://docs.gradle.org/current/userguide/custom_plugins.html#sec:convention_plugins).
615
615
616
616
Then, follow the steps to [set up the Dokka convention plugin](#set-up-the-dokka-convention-plugin) and
617
-
[apply it across your modules](#apply-the-convention-plugin-to-your-modules).
617
+
[apply it across your subprojects](#apply-the-convention-plugin-to-your-subprojects).
618
618
619
619
### Update documentation aggregation in multi-module projects
620
620
621
-
Dokka can aggregate the documentation from multiple modules (subprojects) into a single output or publication.
621
+
Dokka can aggregate the documentation from multiple subprojects into a single output or publication.
622
622
623
-
As [explained](#apply-the-convention-plugin-to-your-modules), apply the Dokka plugin to all documentable subprojects before aggregating the documentation.
623
+
As [explained](#apply-the-convention-plugin-to-your-subprojects), apply the Dokka plugin to all documentable subprojects before aggregating the documentation.
624
624
625
625
Aggregation in DGP v2 uses the `dependencies {}` block instead of tasks and can be added in any `build.gradle.kts` file.
626
626
@@ -646,7 +646,7 @@ dependencies {
646
646
647
647
### Change directory of aggregated documentation
648
648
649
-
When DGP aggregates modules, each subproject has its own subdirectory within the aggregated documentation.
649
+
When DGP aggregates subprojects, each subproject has its own subdirectory within the aggregated documentation.
650
650
651
651
In DGP v2, the aggregation mechanism has been updated to better align with Gradle conventions.
652
652
DGP v2 now preserves the full subproject directory to prevent conflicts when aggregating
@@ -676,7 +676,7 @@ may become outdated, potentially causing `404` errors.
676
676
677
677
#### Revert to the DGP v1 directory behavior
678
678
679
-
If your project depends on the directory structure used in DGP v1, you can revert this behavior by manually specifying the module directory.
679
+
If your project depends on the directory structure used in DGP v1, you can revert this behavior by manually specifying the subproject directory.
680
680
Add the following configuration to the `build.gradle.kts` file of each subproject:
681
681
682
682
```kotlin
@@ -687,7 +687,7 @@ plugins {
687
687
}
688
688
689
689
dokka {
690
-
// Overrides the module directory to match the V1 structure
690
+
// Overrides the subproject directory to match the V1 structure
691
691
modulePath.set("maths")
692
692
}
693
693
```
@@ -733,10 +733,10 @@ or both formats at the same time:
733
733
```kotlin
734
734
plugins {
735
735
// Generates HTML documentation
736
-
id("org.jetbrains.dokka") version "2.0.0"
736
+
id("org.jetbrains.dokka") version "%dokkaVersion%"
737
737
738
738
// Generates Javadoc documentation
739
-
id("org.jetbrains.dokka-javadoc") version "2.0.0"
739
+
id("org.jetbrains.dokka-javadoc") version "%dokkaVersion%"
> * Built-in plugins (like HTML and Javadoc) are always applied automatically. You only configure them and do not need dependencies for them.
49
51
>
50
-
> * When documenting multi-module projects (multi-project builds), you need to [share Dokka configuration and plugins across modules](dokka-gradle.md#multi-project-configuration).
52
+
> * When documenting multi-module projects (multi-project builds), you need to [share Dokka configuration and plugins across subprojects](dokka-gradle.md#multi-project-configuration).
51
53
>
52
54
{style="note"}
53
55
@@ -138,7 +140,7 @@ custom style sheets (`customStyleSheets` option), and a modified footer message
138
140
<tabsgroup="build-script">
139
141
<tabtitle="Kotlin"group-key="kotlin">
140
142
141
-
To configure Dokka plugins in a type-safe way, use the `pluginsConfiguration{}` block:
143
+
To configure Dokka plugins in a type-safe way, use the `dokka.pluginsConfiguration{}` block:
142
144
143
145
```kotlin
144
146
dokka {
@@ -155,7 +157,7 @@ For an example of Dokka plugins configuration, see the
155
157
156
158
Dokka allows you
157
159
to extend its functionality
158
-
by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/ae3840edb4e4afd7b3e3768a5fddfe8ec0e08f31/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
160
+
by [configuring custom plugins](https://github.com/Kotlin/dokka/blob/v2.1.0/examples/gradle-v2/custom-dokka-plugin-example/demo-library/build.gradle.kts).
159
161
Custom plugins enable additional processing or modifications to the documentation generation process.
HTML as an output format is supported by all runners. To generate HTML documentation, follow these steps depending on
10
23
your build tool or runner:
11
24
12
25
* For [Gradle](dokka-gradle.md#generate-documentation), run the following tasks:
13
-
*`dokkaGeneratePublicationHtml` to generate documentation only in HTML format.
14
26
*`dokkaGenerate` to generate documentation in [all available formats based on the applied plugins](dokka-gradle.md#configure-documentation-output-format).
27
+
This is the recommended task for most users. When using this task in IntelliJ IDEA, it logs a clickable link to the output.
28
+
*`dokkaGeneratePublicationHtml` to generate documentation only in HTML format. This task exposes the output directory
29
+
as an `@OutputDirectory`. Use this task when you need to consume the generated files in other Gradle tasks, such
30
+
as uploading them to a server, moving them into a GitHub Pages directory, or packaging them into a `javadoc.jar`.
31
+
This task is intentionally not shown in Gradle task groups because it is not meant for everyday use.
15
32
* For [Maven](dokka-maven.md#generate-documentation), run the `dokka:dokka` goal.
16
33
* For [CLI runner](dokka-cli.md#generate-documentation), run with HTML dependencies set.
17
34
@@ -206,7 +223,7 @@ You can modify text in the footer by using the `footerMessage` [configuration op
206
223
Dokka provides the ability to modify [FreeMarker](https://freemarker.apache.org/) templates used for generating
207
224
documentation pages.
208
225
209
-
You can change the header completely, add your own banners/menus/search, load analytics, change body styling and so on.
226
+
You can change the header completely, add your own banners/menus/search, load analytics, change body styling, and so on.
210
227
211
228
Dokka uses the following templates:
212
229
@@ -255,4 +272,4 @@ You can also use the following Dokka-defined [directives](https://freemarker.apa
|`<@resources/>`| Resources such as scripts and stylesheets. |
258
-
|`<@version/>`| The module version taken from configuration. If the [versioning plugin](https://github.com/Kotlin/dokka/tree/%dokkaVersion%/dokka-subprojects/plugin-versioning) is applied, it is replaced with a version navigator. |
275
+
|`<@version/>`| The subproject version taken from configuration. If the [versioning plugin](https://github.com/Kotlin/dokka/tree/%dokkaVersion%/dokka-subprojects/plugin-versioning) is applied, it is replaced with a version navigator. |
Copy file name to clipboardExpand all lines: docs/topics/formats/dokka-javadoc.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
[//]: #(title: Javadoc)
2
2
<primary-labelref="alpha"/>
3
3
4
+
> This guide applies to Dokka Gradle Plugin (DGP) v2 mode. The previous DGP v1 mode is no longer supported.
5
+
> If you're upgrading from v1 to v2 mode, see the [Migration guide](dokka-migration.md).
6
+
>
7
+
{style="note"}
8
+
4
9
Dokka's Javadoc output format is a lookalike of Java's
5
10
[Javadoc HTML format](https://docs.oracle.com/en/java/javase/19/docs/api/index.html).
6
11
@@ -19,12 +24,9 @@ and you can find the source code on [GitHub](https://github.com/Kotlin/dokka/tre
19
24
20
25
## Generate Javadoc documentation
21
26
22
-
> These instructions reflect Dokka Gradle plugin v1 configuration and tasks. Starting from Dokka 2.0.0, [the Gradle tasks to generate documentation changed](dokka-migration.md#select-documentation-output-format).
23
-
> For more details and the full list of changes in Dokka Gradle Plugin v2, see the [Migration guide](dokka-migration.md).
24
-
>
25
-
> The Javadoc format does not support multiplatform projects.
27
+
> The Javadoc format does not support multi-project builds or Kotlin Multiplatform projects.
26
28
>
27
-
{style="warning"}
29
+
{style="tip"}
28
30
29
31
30
32
<tabsgroup="build-script">
@@ -35,13 +37,14 @@ You need to apply the corresponding plugin id in the `plugins {}` block of your
35
37
36
38
```kotlin
37
39
plugins {
38
-
id("org.jetbrains.dokka-javadoc") version "2.0.0"
40
+
id("org.jetbrains.dokka-javadoc") version "%dokkaVersion%"
39
41
}
40
42
```
41
43
42
44
Once you applied the plugin, you can run the following tasks:
43
-
*`dokkaGeneratePublicationJavadoc` to generate documentation only in Javadoc format.
45
+
44
46
*`dokkaGenerate` to generate documentation in [all available formats based on the applied plugins](dokka-gradle.md#configure-documentation-output-format).
47
+
*`dokkaGeneratePublicationJavadoc` to generate documentation only in Javadoc format.
45
48
46
49
The `javadoc.jar` file can be generated separately. For more information, see [Building `javadoc.jar`](dokka-gradle.md#build-javadoc-jar).
0 commit comments