Closed knolleCC closed 4 years ago
I guess this issue is related to the not existing https://docs.oracle.com/javase/10/docs/api/package-list
linked also in the following issue: https://issues.apache.org/jira/projects/MJAVADOC/issues/MJAVADOC-524?filter=allopenissues
the linked issue seemed to be fixed. Is there a new status for dokka?
Still not working with JDK 10. As a workaround I use JDK 8.
Problem with missing package-list
fixed, but not a problem with Dokka incompatibility with JDK 10, need further investigation
Is there any status update on this? I would also benefit from this as it would be needed to make spring-auto-restdocs java 10 compatible. https://github.com/ScaCap/spring-auto-restdocs/issues/243
Looks like you need this: https://docs.oracle.com/javase/9/docs/api/jdk/javadoc/doclet/package-summary.html#migration . However, no idea how to support both Java <= 9 and Java >= 10 at the same time.
Still broken on Java 11
This effectively prevents one to build Kotlin JARs with JDK10+ and deploy them to Maven Central, since Maven Central requires javadoc artifacts (produced by Dokka). Huge blocker!
The missing package-list
is renamed to element-list
in JDK 11.
Dokka 0.9.18 also uses the wrong URL's for online JDK documentation on JDK 11:
dokka {
jdkVersion = 11
}
Results in:
Caused by: java.lang.RuntimeException: Exception while loading package-list from ExternalDocumentationLinkImpl(url=https://docs.oracle.com/javase/11/docs/api/, packageListUrl=https://docs.oracle.com/javase/11/docs/api/package-list)
The url
should be https://docs.oracle.com/en/java/javase/11/docs/api/ and the packageListUrl
should be https://docs.oracle.com/en/java/javase/11/docs/api/element-list
Corresponding YouTrack issue: https://youtrack.jetbrains.com/issue/KT-31710
Any news on this? When can we expect a fix for it?
The Dokka JDK 11 compliance is what currently prevents me - and others, I presume - from releasing JDK 11 OSS projects through Sonatype OSS Nexus.
Is there some other means of generating JavaDoc for Kotlin? It may not need to be perfect, but it needs to exist in order to release OSS software.
Has HtmlDoclet moved to jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java in Java 11?http://hg.openjdk.java.net/jdk/jdk/file/82767203606e/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
How are other people working around this? Do I need to install Java 8 in order to deploy to Sonatype? I'm willing to switch my build to Gradle, but it looks like it's broken there too.
Hi, we are working on this issue. The main problem is that in the JDK9+ the entire doclet model has changed and we have to reimplement the javadoc format from scratch, so it's gonna take a while, but it's planned for the next release
First of I'd like to thank everyone involved in dokka :100: and I understand that the fix may take a while. I just have a question, might not be helpful but here I go.
I get the following error if I run a command like ./gradlew dokka
The above is my task for generating documentation in all my modules
Execution failed for task ':dokka'. com/sun/tools/doclets/formats/html/HtmlDoclet
What's strange is I can run the dokka
task from the gradle toolbar in android studio for all the sub-modules (that have the dokka task) and this works without throwing an exceptions.
Honestly I don't know why that is possible, I'd expect both methods to fail, :woman_shrugging: and by no means am I gradle expert so perhaps someone could explain what differs between ./gradlew dokka
and manually running the dokka task for each of the sub-modules
So each of my sub-modules have a similar configuration as shown below
dokka {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/docs/javadoc"
configuration {
moduleName = 'ui'
reportUndocumented = true
platform = "JVM"
jdkVersion = 8
perPackageOption {
prefix = "kotlin"
skipDeprecated = false
reportUndocumented = true
includeNonPublic = false
}
sourceLink {
path = "src/main/kotlin"
url = "https://github.com/anitrend/support-arch/tree/develop/support-ui/src/main/kotlin"
lineSuffix = "#L"
}
externalDocumentationLink {
url = new URL("https://developer.android.com/reference/kotlin/")
packageListUrl = new URL("https://developer.android.com/reference/androidx/package-list")
}
}
}
You most probably have different JDKs involved. In the IDE the gradle tasks usually run with the same JRE as the IDE does. Calling gradlew will either use Java-Home or whatever you have defined in the gradle.properties.
:thinking: that makes sense, I had never thought of that. Thank you for pointing that out :smiley:
It looks like this is still broken...
val dokka by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
outputDirectory = "$buildDir/dokka"
outputFormat = "javadoc"
configuration {
includeNonPublic = false
skipDeprecated = false
reportUndocumented = true
sourceLink {
path = "src/main/kotlin"
url = "https://gitlab.com/braindot/kfiles/tree/master"
lineSuffix = "#L"
}
jdkVersion = 8
}
}
gives error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dokka'.
> com/sun/javadoc/DocErrorReporter
with
------------------------------------------------------------
Gradle 6.0.1
------------------------------------------------------------
Build time: 2019-11-18 20:25:01 UTC
Revision: fad121066a68c4701acd362daf4287a7c309a0f5
Kotlin: 1.3.50
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 13.0.1 (Oracle Corporation 13.0.1+9)
OS: Linux 5.4.6-arch3-1 amd64
and
plugins {
java
id("org.jetbrains.dokka") version "0.10.0"
kotlin("jvm") version "1.3.60"
}
Yes, we still don't support the new Doclet.
This is planned for 0.11.0
to not develop this twice, as we changed the dokka internal model
@kamilok1965 Thanks for the info. Could you add that mention in the README file? Currently it just seems like it should work and it's a waste of time for everyone.
@lennartj said:
The Dokka JDK 11 compliance is what currently prevents me - and others, I presume - from releasing JDK 11 OSS projects through Sonatype OSS Nexus.
I ran into the same thing when using Maven. I tried converting a project to Gradle 6.3 which happily creates a nearly empty myProject-javadoc.jar
file without ever running dokka. I think the key lines in build.gradle.kts
are:
java {
withJavadocJar()
withSourcesJar()
}
It puts nothing in myProject-javadoc.jar
but a /META_INF/MANIFEST.MF
file containing only a version string. Sonatype accepts this as a valid JavaDoc file.
If you have an all Kotlin project, you can even throw your dokka HTML into a javadoc-jar.
java {
// withJavadocJar() // REMOVED THIS LINE
withSourcesJar()
}
tasks {
val dokka by getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/dokka"
}
}
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
dependsOn("dokka")
from("$buildDir/dokka")
}
I have maybe 8 hours of Gradle experience. I am not an expert. This is NOT a fix, or even a good workaround, but it might be better than no workaround. I'll keep updating my build file here as I learn more: https://github.com/GlenKPeterson/Indented/blob/master/build.gradle.kts
I did not manage to use Dokka when pushing a JDK 11 Kotlin project to OSS via Maven release. Any for this? Is there an estimate release date for Dokka 0.11 (being compliant with JDK 11)?
Dokka can be used with JDK 11, only the javadoc output format won't work (which is not needed for OSS, you can provide documentation in any format). We hope to release dokka with Kotlin 1.4
Are there any updates on this regarding this blog entry? https://blog.jetbrains.com/kotlin/2020/08/dokka-preview-based-on-kotlin-1-4-0-rc/
@daviddenton i can confirm both javadoc
and dokka*Doc
are working fine on 1-4-0-rc
. Tested on java 11 & JDK 16 eap (http://jdk.java.net/16/).
Works for me too. Yay! Thank you so much! I'm kind of a Gradle noob, so my example is a little kludgy - any help would be appreciated!
I have to specify dokkaJar
in my build command:
./gradlew clean assemble dokkaJar publish
Then in build.gradle.kts:
plugins {
`java-library`
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.4.0-rc"
kotlin("jvm") version "1.4.0"
}
java {
// withJavadocJar()
withSourcesJar()
}
// I made up a task named dokkaJar
tasks.register<Jar>("dokkaJar") {
archiveClassifier.set("javadoc")
dependsOn("dokkaJavadoc")
from("$buildDir/dokka/javadoc/")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
afterEvaluate {
artifactId = tasks.jar.get().archiveBaseName.get()
}
// Adds the dokka javadoc jar to this publication so it gets signed.
artifact(tasks["dokkaJar"])
I deleted (because outputFormat
is no longer valid):
tasks {
val dokka by getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/dokka"
}
}
I am experiencing an issue with dokka, same as the other posters. The following will result in an error. Anyone with a resolution?
gradle code:
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
task packageJavadoc(type: Jar, dependsOn: 'dokkaJavadoc') {
from "$buildDir/javadoc"
archiveClassifier.set("javadoc")
}
error:
Caused by: java.lang.NoClassDefFoundError: com/sun/tools/doclets/formats/html/HtmlDoclet
at org.jetbrains.dokka.javadoc.JavadocGenerator.buildPages(dokka-adapters.kt:16)
at org.jetbrains.dokka.GeneratorKt.buildAll(Generator.kt:13)
at org.jetbrains.dokka.GeneratorKt.buildAll(Generator.kt:23)
at org.jetbrains.dokka.DokkaGenerator.generate(DokkaGenerator.kt:47)
at org.jetbrains.dokka.DokkaBootstrapImpl.generate(DokkaBootstrapImpl.kt:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.jetbrains.dokka.DelegatedInvocationHandler.invoke(ProxyUtils.kt:41)
at com.sun.proxy.$Proxy184.generate(Unknown Source)
at org.jetbrains.dokka.gradle.DokkaTask.generate(main.kt:368)
@drxeno02 the old Dokka versions are not supported, please switch to 1.4.32
@kamildoleglo Hello friend. Sorry, I may not be understanding. Isn't the latest dokka plugin 0.9.18
?
Ref- https://plugins.gradle.org/plugin/org.jetbrains.dokka-android
@kamildoleglo Hello friend. Sorry, I may not be understanding. Isn't the latest dokka plugin
0.9.18
?Ref- https://plugins.gradle.org/plugin/org.jetbrains.dokka-android
No, you can see the full document of plugin version 1.4.32
from here: https://kotlin.github.io/dokka/1.4.32/
This effectively prevents one to build Kotlin JARs with JDK10+ and deploy them to Maven Central, since Maven Central requires javadoc artifacts (produced by Dokka). Huge blocker!
did you find any solution?
When using Dokka 9.16 with JDK-10 the generation with
outputFormat=javadoc
fails with the following message:I guess its due to the removal of the old HtmlDoclet in Java 10.