solonovamax
11/21/2023, 1:01 AMtasks {
val dokkaHtml by named<DokkaTask>("dokkaHtml")
val javadocJar by register<Jar>("javadocJar") {
dependsOn(dokkaHtml)
from(dokkaHtml.outputDirectory)
archiveClassifier = "javadoc"
group = JavaBasePlugin.DOCUMENTATION_GROUP
}
publishing.publications.withType<MavenPublication>().configureEach {
artifact(javadocJar)
}
}
and in a non-MPP project, the publishing part is switched out for what applies to that.
Publishing the javadocs in this way does produce a -javadoc
jar, however, looking at the .module
file that gradle produces, it does not list the javadoc. (both MPP and kotlin/jvm)
If you make a standard java project with
java {
withSourcesJar()
withJavadocJar()
}
then, it will produce a .module
file which contains the following:
{
"formatVersion": "1.1",
"component": {
"group": "test-groupid",
"module": "lib",
"version": "1.2.3",
"attributes": {
"org.gradle.status": "release"
}
},
"createdBy": {
"gradle": {
"version": "8.4"
}
},
"variants": [
// [...]
{
"name": "javadocElements",
"attributes": {
"org.gradle.category": "documentation",
"org.gradle.dependency.bundling": "external",
"org.gradle.docstype": "javadoc",
"org.gradle.usage": "java-runtime"
},
"files": [
{
"name": "lib-1.2.3-javadoc.jar",
"url": "lib-1.2.3-javadoc.jar",
"size": 80337,
"sha512": "1c2d1f68d8eebbca6fc926227bb2e8df1f9ea2dda5723178492027b10533f9b89179ce59038ae219df740ddfe88792a23e07c320b76d5ed168ce816c891e5840",
"sha256": "a9f21d3ae2a54d1c7336a13fd9468af35d270a183aaabc377ff08692320b0633",
"sha1": "8057ffdedfffb8bef9757c7ccbbeac367dfd1025",
"md5": "adad08c12523570066086bf8987483eb"
}
]
}
]
}
Is there any way to get this same behaviour with dokka?Adam S
11/29/2023, 6:21 AMCLOVIS
11/29/2023, 8:50 AMAdam S
11/29/2023, 8:57 AMCLOVIS
11/29/2023, 8:59 AMI bet it's not using the Gradle metadata though, probably just the Maven dataProbably. I can't speak for OP, but personally, as long as all the MavenCentral-based tools can find the documentation, and IDEA can find it too (even if it's from the sources JAR), I don't really mind what's in the metadata
solonovamax
12/02/2023, 9:45 PM