在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Kotlin/dokka开源软件地址(OpenSource Url):https://github.com/Kotlin/dokka开源编程语言(OpenSource Language):Kotlin 97.0%开源软件介绍(OpenSource Introduction):DokkaDokka is a documentation engine for Kotlin, performing the same function as javadoc for Java. Just like Kotlin itself, Dokka fully supports mixed-language Java/Kotlin projects. It understands standard Javadoc comments in Java files and KDoc comments in Kotlin files, and can generate documentation in multiple formats including standard Javadoc, HTML and Markdown. Using DokkaFull documentation is available at https://kotlin.github.io/dokka/1.7.0/ Using the Gradle pluginNote: If you are upgrading from 0.10.x to a current release of Dokka, please have a look at our migration guide The preferred way is to use build.gradle.kts: plugins {
id("org.jetbrains.dokka") version "1.7.0"
}
repositories {
mavenCentral()
} The plugin adds Applying pluginsDokka plugin creates Gradle configuration for each output format in the form of dependencies {
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.0")
} You can also create a custom Dokka task and add plugins directly inside: val customDokkaTask by creating(DokkaTask::class) {
dependencies {
plugins("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.0")
}
} Please note that To generate the documentation, use the appropriate ./gradlew dokkaHtml Please see the Dokka Gradle example project for an example. We encourage users to create their own plugins and share them with the community on official plugins list. AndroidMake sure you apply Dokka after buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}")
}
}
repositories {
mavenCentral()
}
apply(plugin= "com.android.library")
apply(plugin= "kotlin-android")
apply(plugin= "org.jetbrains.dokka") dokkaHtml.configure {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
}
}
} Multi-module projectsFor documenting Gradle multi-module projects, you can use tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
}
Using the Maven pluginThe Maven plugin does not support multi-platform projects. Documentation is by default generated in The following goals are provided by the plugin:
Applying pluginsYou can add plugins inside the <plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>${dokka.version}</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>dokka</goal>
</goals>
</execution>
</executions>
<configuration>
<dokkaPlugins>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>kotlin-as-java-plugin</artifactId>
<version>${dokka.version}</version>
</plugin>
</dokkaPlugins>
</configuration>
</plugin> Please see the Dokka Maven example project for an example. Using the Command LineTo run Dokka from the command line, download the Dokka CLI runner. To generate documentation, run the following command:
You can also use a JSON file with dokka configuration:
Output formatsDokka documents Java classes as seen in Kotlin by default, with javadoc format being the only exception.
If you want to generate the documentation as seen from Java perspective, you can add the dependencies{
implementation("...")
dokkaGfmPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:${dokka-version}")
} FAQIf you encounter any problems, please see the FAQ. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论