Getting Started
So, you have a Kotlin or Java project that uses Gradle and you want to generate some pretty API reference documentation. You've come to the right place.
Find the latest version of Dokkatoo
Find the latest version of Dokkatoo:
Choose a format
Dokkatoo is very flexible, and can generate documentation in multiple formats. For examples of the sites Dokkatoo can generate, check out the Showcase.
If you're unsure about which format to choose, I recommend using the HTML plugin. It has the best support and the most features, and you can always add another format later!
For more detailed information see the Dokka documentation.
- HTML
- Javadoc
- Jekyll
- GFM
- All formats
- Pick and Choose
The HTML plugin provides tasks that can generate any of the other formats.
plugins {
id("dev.adamko.dokkatoo-html") version "$dokkatooVersion"
}
The Javadoc plugin adds a Javadoc output format that simulates the appearance of Java's Javadoc HTML.
plugins {
id("dev.adamko.dokkatoo-javadoc") version "$dokkatooVersion"
}
The Javadoc format is in its early stages, so you may experience issues and encounter bugs. See Dokka for the latest information.
The Jekyll plugin can generate documentation in Jekyll Flavoured Markdown format. It supports both multi-module and multiplatform projects.
plugins {
id("dev.adamko.dokkatoo-jekyll") version "$dokkatooVersion"
}
The Jekyll format is in its early stages, so you may experience issues and encounter bugs. See Dokka for the latest information.
The GFM plugin adds the ability to generate documentation in GitHub Flavoured Markdown format. It supports both multi-module and multiplatform projects.
plugins {
id("dev.adamko.dokkatoo-gfm") version "$dokkatooVersion"
}
The GFM format is in its early stages, so you may experience issues and encounter bugs. See Dokka for the latest information.
The regular plugin provides tasks that can generate any of the other formats.
This option is the most flexible, but if you have decided you only want one format, then select it.
plugins {
id("dev.adamko.dokkatoo") version "$dokkatooVersion"
}
Of course, you can pick and choose your formats à la carte! Just apply the formats you want.
For example, you could choose to generate HTML and Javadoc.
plugins {
id("dev.adamko.dokkatoo-html") version "$dokkatooVersion"
id("dev.adamko.dokkatoo-javadoc") version "$dokkatooVersion"
}
Apply Dokkatoo to your project
Now let's see how to apply Dokkatoo to a Gradle project.
- I have a single project
- I have multiple subprojects
Apply the appropriate plugin for any formats you'd like to generate.
For example, HTML and Javadoc:
plugins {
id("dev.adamko.dokkatoo") version "$dokkatooVersion"
}
Run the generation task
./gradlew :dokkatooGenerate
View the results in the ./build/dokka/
directory.
Dokkatoo can aggregate documentation from multiple subprojects.
To do this, apply the Dokkatoo plugin in all subprojects that should be documented.
In the aggregating project, depend on the other subprojects.
plugins {
id("dev.adamko.dokkatoo") version "$dokkatooVersion"
}
dependencies {
// aggregate both subproject-hello and subproject-world
// the subprojects must also have Dokkatoo applied
dokkatoo(project(":subproject-hello"))
dokkatoo(project(":subproject-world"))
}
Run the Dokkatoo generation task.
./gradlew :dokkatooGenerate
Dokkatoo will then generate documentation into ./build/dokka/
Only run the dokkatooGenerate
task in the aggregating project
by prefixing the task name with the subproject path,
e.g. :my-subproject:dokkatooGenerate
.
If the root project is aggregating, prefix the task with a single :
.