Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to generate Javadoc with Java 10 (Doclet missing?) #294

Closed
knolleCC opened this issue Apr 9, 2018 · 31 comments
Closed

Fail to generate Javadoc with Java 10 (Doclet missing?) #294

knolleCC opened this issue Apr 9, 2018 · 31 comments
Assignees
Labels
Milestone

Comments

@knolleCC
Copy link

knolleCC commented Apr 9, 2018

When using Dokka 9.16 with JDK-10 the generation with outputFormat=javadoc fails with the following message:

* What went wrong:
Execution failed for task ':dokkaJavadoc'.
> com/sun/tools/doclets/formats/html/HtmlDoclet

I guess its due to the removal of the old HtmlDoclet in Java 10.

@kristiyanP
Copy link

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

@henry1986
Copy link

the linked issue seemed to be fixed. Is there a new status for dokka?

geekbeast added a commit to openlattice/conductor-client that referenced this issue Jul 14, 2018
@Maurice-Mueller
Copy link

Still not working with JDK 10. As a workaround I use JDK 8.

@semoro
Copy link
Contributor

semoro commented Aug 16, 2018

Problem with missing package-list fixed, but not a problem with Dokka incompatibility with JDK 10, need further investigation

@rubenpirotteQNH
Copy link

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.
ScaCap/spring-auto-restdocs#243

@LDVSOFT
Copy link

LDVSOFT commented Sep 19, 2018

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.

rocketraman added a commit to rocketraman/logging-log4j-kotlin that referenced this issue Nov 2, 2018
Unfortunately due to Kotlin/dokka#294 the
build will be limited to jdk8 for now.
rocketraman added a commit to rocketraman/logging-log4j-kotlin that referenced this issue Nov 2, 2018
Unfortunately due to Kotlin/dokka#294 the
build will be limited to jdk8 for now.
DanySK added a commit to AlchemistSimulator/Alchemist that referenced this issue Jan 21, 2019
@mkobit
Copy link

mkobit commented Feb 12, 2019

Still broken on Java 11

@mvysny
Copy link

mvysny commented Apr 12, 2019

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!

@lion7
Copy link

lion7 commented May 3, 2019

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

josephlbarnett added a commit to josephlbarnett/dokka that referenced this issue May 3, 2019
For jdk 11+, look at /en/java/javase instead of /javase
For jdk 10+, look at element-list instead of package-list,
and parse the module out to generate the correct class link.

Fixes Kotlin#416
Might also fix Kotlin#294
LeoColman added a commit to kotest/kotest that referenced this issue May 5, 2019
Letting travis build with `./gradlew build` was making dokka fail, due to Kotlin/dokka#294
This may be reverted if Travis runs with JDK < 10 or when that issue is fixed.
@kamildoleglo
Copy link
Contributor

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

@CLOVIS-AI
Copy link
Contributor

@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.

Nylle added a commit to Nylle/Test that referenced this issue Mar 23, 2020
DanySK added a commit to DanySK/upgradle that referenced this issue Mar 24, 2020
binkley pushed a commit to binkley/kunits that referenced this issue Mar 27, 2020
@GlenKPeterson
Copy link

GlenKPeterson commented Apr 2, 2020

@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

@cfries
Copy link

cfries commented Jun 23, 2020

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)?

@kamildoleglo
Copy link
Contributor

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

Tapchicoma added a commit to Tapchicoma/ktlint that referenced this issue Aug 4, 2020
It is a bug in Dokka, see Kotlin/dokka#294

Signed-off-by: Yahor Berdnikau <[email protected]>
@daviddenton
Copy link

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/

@sureshg
Copy link

sureshg commented Aug 4, 2020

@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/).

Tapchicoma added a commit to pinterest/ktlint that referenced this issue Aug 5, 2020
* Allow to switch between kotlin and kotlin-dev versions.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Replace 'com.vanniktech.maven.publish' with 'maven-publish' plugin.

This allows to publish snapshots build against kotlin dev version.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Add shodowJar to publication.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Remove MavenLocalTest repository.

This repository is not needed, 'maven-publish' actually adds it automatically.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Update verification metadata.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Fix repositories order.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Add verification metadata for kotlin dev dependencies.

* Update CI configuration.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Fix publishing task.

It will use proper dependency on maven publish tasks.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Update documentation.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Disable javadoc generation on Java 10+ versions.

It is a bug in Dokka, see Kotlin/dokka#294

Signed-off-by: Yahor Berdnikau <[email protected]>

* Remove unused kotlinx repository.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Update Kotlin development version to 1.4.0-rc.

Signed-off-by: Yahor Berdnikau <[email protected]>

* Use defined version to set kotlin dev snapshot version.

Signed-off-by: Yahor Berdnikau <[email protected]>
@GlenKPeterson
Copy link

GlenKPeterson commented Aug 20, 2020

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"
    }
}

@drxeno02
Copy link

drxeno02 commented Jun 4, 2021

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)

@kamildoleglo
Copy link
Contributor

@drxeno02 the old Dokka versions are not supported, please switch to 1.4.32

@drxeno02
Copy link

drxeno02 commented Jun 4, 2021

@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

@wax911
Copy link

wax911 commented Jun 5, 2021

@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/

@AbrahamArmasCordero
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.