有没有人遇到同样的问题?使用 Dokka 记录数据类时
/**
* Data class for which we want documentation
*/
data class DokkaData(
/** A String value */
val aString: String,
/** An Integer value */
val anInt: Int,
/** Yes, a Boolean value. My favorite. */
val aBoolean: Boolean) {
/**
* Checks that all values are representation of `1`
*/
fun isOne() = aString == "1" && anInt == 1 && aBoolean
}
但是,当使用 dokkaJavadoc 将库导出到 mavenLocal 时:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
id("org.jetbrains.dokka") version "1.6.10"
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
task dokkaJavadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set("javadoc")
from dokkaJavadoc.outputDirectory
}
publishing {
publications {
release(MavenPublication) {
groupId = "com.dokkatests.testlib"
artifactId = "lib"
version = "2.1-dataDoc"
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact(dokkaJavadocJar)
}
}
}
生成的库 javadoc 正确显示为方法,但不是数据类级别
注:html文档完整,仅针对Android Studio中显示的文档有问题。我没有找到任何其他关于这个问题的参考,这很奇怪,因为它对我来说看起来像是一个障碍。有什么线索吗?